Skip to content

Commit

Permalink
Check that thresholds are decreasing, reach the min level and stay there
Browse files Browse the repository at this point in the history
  • Loading branch information
UdjinM6 committed Sep 10, 2020
1 parent 5b44deb commit dae4a19
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
23 changes: 23 additions & 0 deletions test/functional/feature_block_reward_reallocation.py
Expand Up @@ -122,6 +122,7 @@ def run_test(self):
bi = self.nodes[0].getblockchaininfo()
assert_equal(bi['blocks'], 1499)
assert_equal(bi['bip9_softforks']['realloc']['statistics']['threshold'], self.threshold(2))
pre_locked_in_blockhash = bi['bestblockhash']

self.signal(396, True) # just enough to lock in
self.log.info("Advanced to LOCKED_IN at height = 1999")
Expand Down Expand Up @@ -180,5 +181,27 @@ def run_test(self):
assert_equal(bt['coinbasevalue'], 9491484944)
assert_equal(bt['masternode'][0]['amount'], 5694890966) # 0.6

self.log.info("Rollback the chain back to the STARTED state")
self.mocktime = self.nodes[0].getblock(pre_locked_in_blockhash, 1)['time']
for node in self.nodes:
node.invalidateblock(pre_locked_in_blockhash)
self.sync_all()
# create and send non-signalling block
test_block = self.create_test_block()
self.nodes[0].p2p.send_blocks_and_test([test_block], self.nodes[0], timeout=5)
bi = self.nodes[0].getblockchaininfo()
assert_equal(bi['blocks'], 1499)
assert_equal(bi['bip9_softforks']['realloc']['status'], 'started')
assert_equal(bi['bip9_softforks']['realloc']['statistics']['threshold'], self.threshold(2))

self.log.info("Check thresholds reach min level and stay there")
for i in range(8): # 7 to reach min level and 1 more to check it doesn't go lower than that
self.signal(0, False) # no need to signal
bi = self.nodes[0].getblockchaininfo()
assert_equal(bi['blocks'], 1999 + i * 500)
assert_equal(bi['bip9_softforks']['realloc']['status'], 'started')
assert_equal(bi['bip9_softforks']['realloc']['statistics']['threshold'], self.threshold(i + 3))
assert_equal(bi['bip9_softforks']['realloc']['statistics']['threshold'], 300)

if __name__ == '__main__':
BlockRewardReallocationTest().main()
2 changes: 1 addition & 1 deletion test/functional/test_runner.py
Expand Up @@ -59,6 +59,7 @@
# Scripts that are run by the travis build process.
# Longest test should go first, to favor running tests in parallel
'feature_dip3_deterministicmns.py', # NOTE: needs dash_hash to pass
'feature_block_reward_reallocation.py',
'wallet_hd.py',
'wallet_backup.py',
# vv Tests less than 5m vv
Expand All @@ -82,7 +83,6 @@
'feature_llmq_is_retroactive.py', # NOTE: needs dash_hash to pass
'feature_llmq_dkgerrors.py', # NOTE: needs dash_hash to pass
'feature_dip4_coinbasemerkleroots.py', # NOTE: needs dash_hash to pass
'feature_block_reward_reallocation.py',
# vv Tests less than 60s vv
'p2p_sendheaders.py', # NOTE: needs dash_hash to pass
'wallet_zapwallettxes.py',
Expand Down

0 comments on commit dae4a19

Please sign in to comment.