mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 23:09:44 -04:00
test: Add time-timewarp-attack boundary cases
This commit is contained in:
parent
55d663cb15
commit
31378d44f4
1 changed files with 9 additions and 0 deletions
|
@ -159,6 +159,15 @@ class MiningTest(BitcoinTestFramework):
|
||||||
bad_block.solve()
|
bad_block.solve()
|
||||||
assert_raises_rpc_error(-25, 'time-timewarp-attack', lambda: node.submitheader(hexdata=CBlockHeader(bad_block).serialize().hex()))
|
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):
|
def run_test(self):
|
||||||
node = self.nodes[0]
|
node = self.nodes[0]
|
||||||
self.wallet = MiniWallet(node)
|
self.wallet = MiniWallet(node)
|
||||||
|
|
Loading…
Add table
Reference in a new issue