Skip to content

Commit 5116dd4

Browse files
committed
Merge bitcoin/bitcoin#30698: test: Add time-timewarp-attack boundary cases
31378d4 test: Add time-timewarp-attack boundary cases (Greg Sanders) Pull request description: Basic addition to test case added in bitcoin/bitcoin#30681 ACKs for top commit: fjahr: Code review ACK 31378d4 achow101: ACK 31378d4 tdb3: ACK 31378d4 Tree-SHA512: 7d18af9e7fac0ecb0fb5e4c009d6ce3f9af849b4abc54ae8cf681dc8b882aaa9b4cffd7f798b7193c76d89f96ec2cb6dbd13e341882d59b0580d3573ec675ffd
2 parents d50f0ce + 31378d4 commit 5116dd4

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/functional/mining_basic.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,15 @@ def test_timewarp(self):
159159
bad_block.solve()
160160
assert_raises_rpc_error(-25, 'time-timewarp-attack', lambda: node.submitheader(hexdata=CBlockHeader(bad_block).serialize().hex()))
161161

162+
self.log.info("Test timewarp protection boundary")
163+
bad_block.nTime = t + MAX_FUTURE_BLOCK_TIME - MAX_TIMEWARP - 1
164+
bad_block.solve()
165+
assert_raises_rpc_error(-25, 'time-timewarp-attack', lambda: node.submitheader(hexdata=CBlockHeader(bad_block).serialize().hex()))
166+
167+
bad_block.nTime = t + MAX_FUTURE_BLOCK_TIME - MAX_TIMEWARP
168+
bad_block.solve()
169+
node.submitheader(hexdata=CBlockHeader(bad_block).serialize().hex())
170+
162171
def run_test(self):
163172
node = self.nodes[0]
164173
self.wallet = MiniWallet(node)

0 commit comments

Comments
 (0)