aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAva Chow <github@achow101.com>2024-08-26 14:44:33 -0400
committerAva Chow <github@achow101.com>2024-08-26 14:44:33 -0400
commit5116dd4b834ea3425c5f0a8682dc04d41cc764e3 (patch)
treee83ed4f16b1e6a96d6602ebeef816da466aeaa76
parentd50f0ce248a32a373fb22ade33e565d234ddc335 (diff)
parent31378d44f44cabc576bf92ddd61afde4b528de77 (diff)
Merge bitcoin/bitcoin#30698: test: Add time-timewarp-attack boundary cases
31378d44f44cabc576bf92ddd61afde4b528de77 test: Add time-timewarp-attack boundary cases (Greg Sanders) Pull request description: Basic addition to test case added in https://github.com/bitcoin/bitcoin/pull/30681 ACKs for top commit: fjahr: Code review ACK 31378d44f44cabc576bf92ddd61afde4b528de77 achow101: ACK 31378d44f44cabc576bf92ddd61afde4b528de77 tdb3: ACK 31378d44f44cabc576bf92ddd61afde4b528de77 Tree-SHA512: 7d18af9e7fac0ecb0fb5e4c009d6ce3f9af849b4abc54ae8cf681dc8b882aaa9b4cffd7f798b7193c76d89f96ec2cb6dbd13e341882d59b0580d3573ec675ffd
-rwxr-xr-xtest/functional/mining_basic.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/functional/mining_basic.py b/test/functional/mining_basic.py
index c0df120c65..aca71933ec 100755
--- a/test/functional/mining_basic.py
+++ b/test/functional/mining_basic.py
@@ -159,6 +159,15 @@ class MiningTest(BitcoinTestFramework):
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)