Skip to content

Commit 988a164

Browse files
committed
Fix voting tests
1 parent a62e08f commit 988a164

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

tests/tests/voting_tests.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -784,15 +784,16 @@ BOOST_AUTO_TEST_CASE( witness_votes_calculation )
784784
generate_blocks( db.get_dynamic_global_properties().next_maintenance_time );
785785

786786
// pob activated
787+
bool has_hf_2262 = ( HARDFORK_CORE_2262_PASSED( db.get_dynamic_global_properties().next_maintenance_time ) );
787788
expected_votes[0] = 0; // 225 days
788789
expected_votes[1] = 0; // 270 days
789790
expected_votes[2] = 0; // 315 days
790791
expected_votes[3] = 0; // 360 days
791792
int64_t base4 = 40 * 8 + (114 - 40) - 40;
792-
expected_votes[4] = base4 - base4 * 2 / 8; // 405 days
793+
expected_votes[4] = ( has_hf_2262 ? 0 : ( base4 - base4 * 2 / 8 ) ); // 405 days
793794
expected_votes[5] = 0; // 450 days
794795
expected_votes[6] = 0; // 495 days
795-
int64_t base7 = 20 * 8 * 8 + (30 - 20) * 8 + (117 - 30 - 20) - (30 - 20);
796+
int64_t base7 = 20 * 8 * 8 + ( has_hf_2262 ? 0 : ( (30 - 20) * 8 + (117 - 30 - 20) - (30 - 20) ) );
796797
expected_votes[7] = base7 - base7 * 5 / 8; // 540 days
797798
expected_votes[8] = 0; // 585 days
798799
expected_votes[9] = 0; // 630 days
@@ -808,16 +809,19 @@ BOOST_AUTO_TEST_CASE( witness_votes_calculation )
808809

809810
expected_active_witnesses = original_wits;
810811
expected_active_witnesses.erase( *expected_active_witnesses.rbegin() );
811-
expected_active_witnesses.erase( *expected_active_witnesses.rbegin() );
812-
expected_active_witnesses.insert( wit_ids[4] );
812+
if( !has_hf_2262 )
813+
{
814+
expected_active_witnesses.erase( *expected_active_witnesses.rbegin() );
815+
expected_active_witnesses.insert( wit_ids[4] );
816+
}
813817
expected_active_witnesses.insert( wit_ids[7] );
814818
BOOST_CHECK( db.get_global_properties().active_witnesses == expected_active_witnesses );
815819

816820
// some days passed
817821
generate_blocks( tick_start_time + fc::days(60+180) );
818822
generate_blocks( db.get_dynamic_global_properties().next_maintenance_time );
819823

820-
bool has_hf_2262 = ( HARDFORK_CORE_2262_PASSED( db.get_dynamic_global_properties().next_maintenance_time ) );
824+
has_hf_2262 = ( HARDFORK_CORE_2262_PASSED( db.get_dynamic_global_properties().next_maintenance_time ) );
821825
// check votes
822826
base4 = 40 * 6 + (114 - 40) - 40;
823827
expected_votes[4] = ( has_hf_2262 ? 0 : (base4 - base4 * 6 / 8) ); // 585 days

0 commit comments

Comments
 (0)