Merge pull request #201 from peerplays-network/fix_flag

Fix update_last_voting_time flag
This commit is contained in:
pbattu123 2019-10-27 12:44:43 -03:00 committed by GitHub
commit 5caaedd43a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 12 deletions

View file

@ -287,7 +287,7 @@ void_result account_update_evaluator::do_apply( const account_update_operation&
fc::optional< bool > flag = o.extensions.value.update_last_voting_time; fc::optional< bool > flag = o.extensions.value.update_last_voting_time;
if((o.new_options->votes != acnt->options.votes || if((o.new_options->votes != acnt->options.votes ||
o.new_options->voting_account != acnt->options.voting_account) || o.new_options->voting_account != acnt->options.voting_account) ||
flag) (flag.valid() && *flag))
aso.last_vote_time = d.head_block_time(); aso.last_vote_time = d.head_block_time();
} ); } );
} }

View file

@ -110,6 +110,7 @@ struct gpos_fixture: database_fixture
op.account = account_id; op.account = account_id;
op.new_options = account_id(db).options; op.new_options = account_id(db).options;
op.new_options->votes.insert(vote_for); op.new_options->votes.insert(vote_for);
op.extensions.value.update_last_voting_time = true;
trx.operations.push_back(op); trx.operations.push_back(op);
set_expiration(db, trx); set_expiration(db, trx);
trx.validate(); trx.validate();
@ -349,11 +350,9 @@ BOOST_AUTO_TEST_CASE( dividends )
BOOST_AUTO_TEST_CASE( gpos_basic_dividend_distribution_to_core_asset ) BOOST_AUTO_TEST_CASE( gpos_basic_dividend_distribution_to_core_asset )
{ {
using namespace graphene; using namespace graphene;
ACTORS((alice)(bob)(carol)(dave)); ACTORS((alice)(bob)(carol)(dave));
try { try {
const auto& core = asset_id_type()(db); const auto& core = asset_id_type()(db);
BOOST_TEST_MESSAGE("Creating test asset"); BOOST_TEST_MESSAGE("Creating test asset");
{ {
@ -474,13 +473,11 @@ BOOST_AUTO_TEST_CASE( gpos_basic_dividend_distribution_to_core_asset )
verify_pending_balance(carol, test_asset_object, 0); verify_pending_balance(carol, test_asset_object, 0);
verify_pending_balance(dave, test_asset_object, 10000); verify_pending_balance(dave, test_asset_object, 10000);
advance_to_next_payout_time(); advance_to_next_payout_time();
generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); generate_blocks(db.get_dynamic_global_properties().next_maintenance_time);
generate_block(); // get the maintenance skip slots out of the way generate_block(); // get the maintenance skip slots out of the way
auto verify_dividend_payout_operations = [&](const account_object& destination_account, const asset& expected_payout) auto verify_dividend_payout_operations = [&](const account_object& destination_account, const asset& expected_payout)
{ {
BOOST_TEST_MESSAGE("Verifying the virtual op was created"); BOOST_TEST_MESSAGE("Verifying the virtual op was created");
@ -516,12 +513,10 @@ BOOST_AUTO_TEST_CASE( gpos_basic_dividend_distribution_to_core_asset )
} }
} }
BOOST_AUTO_TEST_CASE( voting ) BOOST_AUTO_TEST_CASE( voting )
{ {
ACTORS((alice)(bob)); ACTORS((alice)(bob));
try { try {
// move to hardfork // move to hardfork
generate_blocks( HARDFORK_GPOS_TIME ); generate_blocks( HARDFORK_GPOS_TIME );
generate_block(); generate_block();
@ -704,8 +699,6 @@ BOOST_AUTO_TEST_CASE( rolling_period_start )
{ {
// period start rolls automatically after HF // period start rolls automatically after HF
try { try {
// advance to HF
// update default gpos global parameters to make this thing faster // update default gpos global parameters to make this thing faster
update_gpos_global(518400, 86400, HARDFORK_GPOS_TIME); update_gpos_global(518400, 86400, HARDFORK_GPOS_TIME);
generate_blocks(HARDFORK_GPOS_TIME); generate_blocks(HARDFORK_GPOS_TIME);
@ -731,6 +724,7 @@ BOOST_AUTO_TEST_CASE( rolling_period_start )
throw; throw;
} }
} }
BOOST_AUTO_TEST_CASE( worker_dividends_voting ) BOOST_AUTO_TEST_CASE( worker_dividends_voting )
{ {
try { try {
@ -1042,7 +1036,6 @@ BOOST_AUTO_TEST_CASE( proxy_voting )
{ {
ACTORS((alice)(bob)); ACTORS((alice)(bob));
try { try {
// move to hardfork // move to hardfork
generate_blocks( HARDFORK_GPOS_TIME ); generate_blocks( HARDFORK_GPOS_TIME );
generate_block(); generate_block();
@ -1153,11 +1146,11 @@ BOOST_AUTO_TEST_CASE( no_proposal )
throw; throw;
} }
} }
BOOST_AUTO_TEST_CASE( database_api ) BOOST_AUTO_TEST_CASE( database_api )
{ {
ACTORS((alice)(bob)); ACTORS((alice)(bob));
try { try {
// move to hardfork // move to hardfork
generate_blocks( HARDFORK_GPOS_TIME ); generate_blocks( HARDFORK_GPOS_TIME );
generate_block(); generate_block();
@ -1251,4 +1244,5 @@ BOOST_AUTO_TEST_CASE( database_api )
throw; throw;
} }
} }
BOOST_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE_END()