From 6a8cd25878e332827bf8d827abaa38341cf3617b Mon Sep 17 00:00:00 2001 From: sierra19XX <15652887+sierra19XX@users.noreply.github.com> Date: Fri, 10 Apr 2020 22:56:20 +1000 Subject: [PATCH] [SON-337] - Prevent update_son_votes without GPOS vesting (#344) Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com> --- libraries/wallet/wallet.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libraries/wallet/wallet.cpp b/libraries/wallet/wallet.cpp index a00636cc..d4146c92 100644 --- a/libraries/wallet/wallet.cpp +++ b/libraries/wallet/wallet.cpp @@ -2594,6 +2594,12 @@ public: bool broadcast /* = false */) { try { FC_ASSERT(sons_to_approve.size() || sons_to_reject.size(), "Both accepted and rejected lists can't be empty simultaneously"); + 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); for (const std::string& son : sons_to_approve) {