Skip to content

Commit 01f6e26

Browse files
authored
Merge pull request #977 from bitshares/release
Merge release branch into testnet branch
2 parents d0badd8 + e1e3ce8 commit 01f6e26

1 file changed

Lines changed: 19 additions & 6 deletions

File tree

tests/tests/bitasset_tests.cpp

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,13 +1036,15 @@ BOOST_AUTO_TEST_CASE( hf_935_test )
10361036
ba_op.issuer = asset_to_update.issuer;
10371037
ba_op.new_options = asset_to_update.bitasset_data(db).options;
10381038
ba_op.new_options.feed_lifetime_sec = HARDFORK_CORE_935_TIME.sec_since_epoch()
1039-
- db.head_block_time().sec_since_epoch()
1040-
+ mi * 3;
1039+
+ mi * 3 + 86400 * 2
1040+
- db.head_block_time().sec_since_epoch();
10411041
trx.operations.push_back(ba_op);
10421042
PUSH_TX(db, trx, ~0);
10431043
trx.clear();
10441044
}
10451045

1046+
bool affected_by_hf_343 = false;
1047+
10461048
// check
10471049
if( i / 2 == 0 ) // before hard fork 890
10481050
{
@@ -1054,8 +1056,14 @@ BOOST_AUTO_TEST_CASE( hf_935_test )
10541056
BOOST_CHECK( db.find<limit_order_object>( sell_id ) );
10551057

10561058
// go beyond hard fork 890
1057-
blocks += generate_blocks(HARDFORK_CORE_868_890_TIME - mi, true, skip);
1058-
blocks += generate_blocks(db.get_dynamic_global_properties().next_maintenance_time, true, skip);
1059+
blocks += generate_blocks( HARDFORK_CORE_868_890_TIME - mi, true, skip );
1060+
bool was_before_hf_343 = ( db.get_dynamic_global_properties().next_maintenance_time <= HARDFORK_CORE_343_TIME );
1061+
1062+
blocks += generate_blocks( db.get_dynamic_global_properties().next_maintenance_time, true, skip );
1063+
bool now_after_hf_343 = ( db.get_dynamic_global_properties().next_maintenance_time > HARDFORK_CORE_343_TIME );
1064+
1065+
if( was_before_hf_343 && now_after_hf_343 ) // if hf 343 executed at same maintenance interval, actually after hf 890
1066+
affected_by_hf_343 = true;
10591067
}
10601068

10611069
// after hard fork 890, if it's before hard fork 935
@@ -1067,8 +1075,13 @@ BOOST_AUTO_TEST_CASE( hf_935_test )
10671075
BOOST_CHECK_EQUAL( usd_id(db).bitasset_data(db).current_feed.maintenance_collateral_ratio, 3500 );
10681076
else // MSSR test, MSSR should be 125%
10691077
BOOST_CHECK_EQUAL( usd_id(db).bitasset_data(db).current_feed.maximum_short_squeeze_ratio, 1250 );
1070-
// but the limit order is still there, because `check_call_order` was incorrectly skipped
1071-
BOOST_CHECK( db.find<limit_order_object>( sell_id ) );
1078+
1079+
if( affected_by_hf_343 ) // if updated bitasset before hf 890, and hf 343 executed after hf 890
1080+
// the limit order should have been filled
1081+
BOOST_CHECK( !db.find<limit_order_object>( sell_id ) );
1082+
else // if not affected by hf 343
1083+
// the limit order should be still there, because `check_call_order` was incorrectly skipped
1084+
BOOST_CHECK( db.find<limit_order_object>( sell_id ) );
10721085

10731086
// go beyond hard fork 935
10741087
blocks += generate_blocks(HARDFORK_CORE_935_TIME - mi, true, skip);

0 commit comments

Comments
 (0)