diff --git a/libraries/wallet/wallet.cpp b/libraries/wallet/wallet.cpp index 4244b7ef..d0372a7d 100644 --- a/libraries/wallet/wallet.cpp +++ b/libraries/wallet/wallet.cpp @@ -2272,6 +2272,7 @@ public: uint16_t desired_number_of_sons, bool broadcast /* = false */) { try { + FC_ASSERT(sons_to_approve.size() || sons_to_reject.size(), "Both accepted and rejected lists can't be empty simultaneously"); account_object voting_account_object = get_account(voting_account); for (const std::string& son : sons_to_approve) { diff --git a/tests/cli/son.cpp b/tests/cli/son.cpp index 1dfd8381..c093cd84 100644 --- a/tests/cli/son.cpp +++ b/tests/cli/son.cpp @@ -481,6 +481,23 @@ BOOST_AUTO_TEST_CASE( update_son_votes_test ) BOOST_CHECK(son2_end_votes == son2_start_votes); son2_start_votes = son2_end_votes; + // Try to accept and reject empty lists + accepted.clear(); + rejected.clear(); + BOOST_REQUIRE_THROW(update_votes_tx = con.wallet_api_ptr->update_son_votes("nathan", accepted, + rejected, 15, true), fc::exception); + BOOST_CHECK(generate_maintenance_block()); + + // Verify the votes + son1_obj = con.wallet_api_ptr->get_son("son1account"); + son1_end_votes = son1_obj.total_votes; + BOOST_CHECK(son1_end_votes == son1_start_votes); + son1_start_votes = son1_end_votes; + son2_obj = con.wallet_api_ptr->get_son("son2account"); + son2_end_votes = son2_obj.total_votes; + BOOST_CHECK(son2_end_votes == son2_start_votes); + son2_start_votes = son2_end_votes; + } catch( fc::exception& e ) { BOOST_TEST_MESSAGE("SON cli wallet tests exception"); edump((e.to_detail_string()));