diff --git a/eosio.system/src/producer_pay.cpp b/eosio.system/src/producer_pay.cpp index 39fe64efc..84e2444ad 100644 --- a/eosio.system/src/producer_pay.cpp +++ b/eosio.system/src/producer_pay.cpp @@ -50,7 +50,7 @@ namespace eosiosystem { if( (timestamp.slot - _gstate.last_name_close.slot) > blocks_per_day ) { name_bid_table bids(_self,_self); auto idx = bids.get_index(); - auto highest = idx.begin(); + auto highest = idx.lower_bound( std::numeric_limits::max()/2 ); if( highest != idx.end() && highest->high_bid > 0 && highest->last_bid_time < (current_time() - useconds_per_day) && diff --git a/tests/eosio.system_tester.hpp b/tests/eosio.system_tester.hpp index 7ce52211c..d2896a39c 100644 --- a/tests/eosio.system_tester.hpp +++ b/tests/eosio.system_tester.hpp @@ -518,6 +518,7 @@ class eosio_system_tester : public TESTER { trx.sign( get_private_key( config::system_account_name, "active" ), control->get_chain_id() ); trx.sign( get_private_key( N(producer1111), "active" ), control->get_chain_id() ); push_transaction( trx ); + produce_block(); } } diff --git a/tests/eosio.system_tests.cpp b/tests/eosio.system_tests.cpp index ac21342b7..b8f5380da 100644 --- a/tests/eosio.system_tests.cpp +++ b/tests/eosio.system_tests.cpp @@ -2367,6 +2367,21 @@ BOOST_FIXTURE_TEST_CASE( multiple_namebids, eosio_system_tester ) try { } FC_LOG_AND_RETHROW() +BOOST_FIXTURE_TEST_CASE( namebid_pending_winner, eosio_system_tester ) try { + cross_15_percent_threshold(); + produce_block( fc::hours(14*24) ); //wait 14 day for name auction activation + transfer( config::system_account_name, N(alice1111111), core_from_string("10000.0000") ); + transfer( config::system_account_name, N(bob111111111), core_from_string("10000.0000") ); + + BOOST_REQUIRE_EQUAL( success(), bidname( "alice1111111", "prefa", core_from_string( "50.0000" ) )); + BOOST_REQUIRE_EQUAL( success(), bidname( "bob111111111", "prefb", core_from_string( "30.0000" ) )); + produce_block( fc::hours(100) ); //should close "perfa" + produce_block( fc::hours(100) ); //should close "perfb" + + //despite "perfa" account hasn't been created, we should be able to create "perfb" account + create_account_with_resources( N(prefb), N(bob111111111) ); +} FC_LOG_AND_RETHROW() + BOOST_FIXTURE_TEST_CASE( vote_producers_in_and_out, eosio_system_tester ) try { const asset net = core_from_string("80.0000");