Skip to content

Commit

Permalink
[SON-337] - Prevent update_son_votes without GPOS vesting (#344)
Browse files Browse the repository at this point in the history
Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com>
  • Loading branch information
sierra19XX and sierra19XX committed Apr 10, 2020
1 parent 7988236 commit 6a8cd25
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions libraries/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2594,6 +2594,12 @@ class wallet_api_impl
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<vesting_balance_object_with_info> vbo_info = get_vesting_balances(voting_account);
std::vector<vesting_balance_object_with_info>::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)
{
Expand Down

0 comments on commit 6a8cd25

Please sign in to comment.