From 31378d44f44cabc576bf92ddd61afde4b528de77 Mon Sep 17 00:00:00 2001 From: Greg Sanders Date: Thu, 22 Aug 2024 12:43:13 -0400 Subject: [PATCH] test: Add time-timewarp-attack boundary cases --- test/functional/mining_basic.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/functional/mining_basic.py b/test/functional/mining_basic.py index c0df120c65a26..aca71933ec503 100755 --- a/test/functional/mining_basic.py +++ b/test/functional/mining_basic.py @@ -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)