diff --git a/libraries/chain/protocol/account.cpp b/libraries/chain/protocol/account.cpp index cf592d5c..08d5a566 100644 --- a/libraries/chain/protocol/account.cpp +++ b/libraries/chain/protocol/account.cpp @@ -171,15 +171,22 @@ void account_options::validate() const { auto needed_witnesses = num_witness; auto needed_committee = num_committee; + auto needed_sons = num_son; for( vote_id_type id : votes ) if( id.type() == vote_id_type::witness && needed_witnesses ) --needed_witnesses; else if ( id.type() == vote_id_type::committee && needed_committee ) --needed_committee; + else if ( id.type() == vote_id_type::son && needed_sons ) + --needed_sons; - FC_ASSERT( needed_witnesses == 0 && needed_committee == 0, - "May not specify fewer witnesses or committee members than the number voted for."); + FC_ASSERT( needed_witnesses == 0, + "May not specify fewer witnesses than the number voted for."); + FC_ASSERT( needed_committee == 0, + "May not specify committee members than the number voted for."); + FC_ASSERT( needed_sons == 0, + "May not specify fewer SONs than the number voted for."); } void affiliate_reward_distribution::validate() const diff --git a/tests/cli/son.cpp b/tests/cli/son.cpp index c093cd84..8ed01d47 100644 --- a/tests/cli/son.cpp +++ b/tests/cli/son.cpp @@ -392,7 +392,7 @@ BOOST_AUTO_TEST_CASE( update_son_votes_test ) accepted.push_back("son1account"); accepted.push_back("son2account"); update_votes_tx = con.wallet_api_ptr->update_son_votes("nathan", accepted, - rejected, 15, true); + rejected, 2, true); BOOST_CHECK(generate_block()); BOOST_CHECK(generate_maintenance_block()); @@ -412,7 +412,7 @@ BOOST_AUTO_TEST_CASE( update_son_votes_test ) rejected.clear(); rejected.push_back("son1account"); update_votes_tx = con.wallet_api_ptr->update_son_votes("nathan", accepted, - rejected, 15, true); + rejected, 1, true); BOOST_CHECK(generate_maintenance_block()); // Verify the votes @@ -431,7 +431,7 @@ BOOST_AUTO_TEST_CASE( update_son_votes_test ) rejected.clear(); rejected.push_back("son1accnt"); BOOST_CHECK_THROW(update_votes_tx = con.wallet_api_ptr->update_son_votes("nathan", accepted, - rejected, 15, true), fc::exception); + rejected, 1, true), fc::exception); BOOST_CHECK(generate_block()); // Verify the votes @@ -449,7 +449,7 @@ BOOST_AUTO_TEST_CASE( update_son_votes_test ) rejected.clear(); rejected.push_back("son2account"); update_votes_tx = con.wallet_api_ptr->update_son_votes("nathan", accepted, - rejected, 15, true); + rejected, 0, true); BOOST_CHECK(generate_maintenance_block()); // Verify the votes @@ -468,7 +468,7 @@ BOOST_AUTO_TEST_CASE( update_son_votes_test ) rejected.push_back("son1accnt"); accepted.push_back("son1accnt"); BOOST_REQUIRE_THROW(update_votes_tx = con.wallet_api_ptr->update_son_votes("nathan", accepted, - rejected, 15, true), fc::exception); + rejected, 1, true), fc::exception); BOOST_CHECK(generate_maintenance_block()); // Verify the votes @@ -485,7 +485,7 @@ BOOST_AUTO_TEST_CASE( update_son_votes_test ) accepted.clear(); rejected.clear(); BOOST_REQUIRE_THROW(update_votes_tx = con.wallet_api_ptr->update_son_votes("nathan", accepted, - rejected, 15, true), fc::exception); + rejected, 1, true), fc::exception); BOOST_CHECK(generate_maintenance_block()); // Verify the votes