From 2a9e28694925529ba9a37c54419a4e70fa5020f8 Mon Sep 17 00:00:00 2001 From: Khaled Al-Hassanieh Date: Thu, 14 Jun 2018 15:22:18 -0400 Subject: [PATCH] Additional check in name bidding --- contracts/eosio.system/voting.cpp | 2 +- unittests/eosio.system_tests.cpp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/contracts/eosio.system/voting.cpp b/contracts/eosio.system/voting.cpp index 31bf70593..166f1707c 100644 --- a/contracts/eosio.system/voting.cpp +++ b/contracts/eosio.system/voting.cpp @@ -152,7 +152,7 @@ namespace eosiosystem { */ if( voter->last_vote_weight <= 0.0 ) { _gstate.total_activated_stake += voter->staked; - if( _gstate.total_activated_stake >= min_activated_stake ) { + if( _gstate.total_activated_stake >= min_activated_stake && _gstate.thresh_activated_stake_time == 0 ) { _gstate.thresh_activated_stake_time = current_time(); } } diff --git a/unittests/eosio.system_tests.cpp b/unittests/eosio.system_tests.cpp index b823eb5a5..25215161d 100644 --- a/unittests/eosio.system_tests.cpp +++ b/unittests/eosio.system_tests.cpp @@ -2063,11 +2063,14 @@ BOOST_FIXTURE_TEST_CASE( buyname, eosio_system_tester ) try { transfer( config::system_account_name, "dan", core_from_string( "10000.0000" ) ); transfer( config::system_account_name, "sam", core_from_string( "10000.0000" ) ); stake_with_transfer( config::system_account_name, "sam", core_from_string( "80000000.0000" ), core_from_string( "80000000.0000" ) ); + stake_with_transfer( config::system_account_name, "dan", core_from_string( "80000000.0000" ), core_from_string( "80000000.0000" ) ); regproducer( config::system_account_name ); BOOST_REQUIRE_EQUAL( success(), vote( N(sam), { config::system_account_name } ) ); // wait 14 days after min required amount has been staked - produce_block( fc::days(14) ); + produce_block( fc::days(7) ); + BOOST_REQUIRE_EQUAL( success(), vote( N(dan), { config::system_account_name } ) ); + produce_block( fc::days(7) ); produce_block(); BOOST_REQUIRE_EXCEPTION( create_accounts_with_resources( { N(fail) }, N(dan) ), // dan shouldn't be able to create fail -- GitLab