Skip to content

Commit

Permalink
test: Add time-timewarp-attack boundary cases
Browse files Browse the repository at this point in the history
  • Loading branch information
instagibbs committed Aug 22, 2024
1 parent 55d663c commit 31378d4
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/functional/mining_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,15 @@ def test_timewarp(self):
bad_block.solve()
assert_raises_rpc_error(-25, 'time-timewarp-attack', lambda: node.submitheader(hexdata=CBlockHeader(bad_block).serialize().hex()))

self.log.info("Test timewarp protection boundary")
bad_block.nTime = t + MAX_FUTURE_BLOCK_TIME - MAX_TIMEWARP - 1
bad_block.solve()
assert_raises_rpc_error(-25, 'time-timewarp-attack', lambda: node.submitheader(hexdata=CBlockHeader(bad_block).serialize().hex()))

bad_block.nTime = t + MAX_FUTURE_BLOCK_TIME - MAX_TIMEWARP
bad_block.solve()
node.submitheader(hexdata=CBlockHeader(bad_block).serialize().hex())

def run_test(self):
node = self.nodes[0]
self.wallet = MiniWallet(node)
Expand Down

0 comments on commit 31378d4

Please sign in to comment.