From 3ffcd4fdd0d82004f78af2402e079c2b6f88e31a Mon Sep 17 00:00:00 2001 From: pbattu123 Date: Mon, 16 Mar 2020 18:24:28 -0300 Subject: [PATCH] Allow voting for son, only if GPOS vesting balance available --- libraries/wallet/wallet.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libraries/wallet/wallet.cpp b/libraries/wallet/wallet.cpp index fb9d242d..5ab144f8 100644 --- a/libraries/wallet/wallet.cpp +++ b/libraries/wallet/wallet.cpp @@ -2589,6 +2589,13 @@ public: bool approve, bool broadcast /* = false */) { try { + + std::vector vbo_info = get_vesting_balances(voting_account); + std::vector::iterator vbo_iter; + vbo_iter = std::find_if(vbo_info.begin(), vbo_info.end(), [](vesting_balance_object_with_info const& obj){return obj.balance_type == vesting_balance_type::gpos;}); + if( vbo_info.size() == 0 || vbo_iter == vbo_info.end()) + FC_THROW("Account ${account} has no core Token ${TOKEN} vested and will not be allowed to vote for the SON account", ("account", voting_account)("TOKEN", GRAPHENE_SYMBOL)); + account_object voting_account_object = get_account(voting_account); account_id_type son_account_id = get_account_id(son); fc::optional son_obj = _remote_db->get_son_by_account(son_account_id);