|
|
|
@ -4,8 +4,7 @@
|
|
|
|
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
"""Test BIP65 (CHECKLOCKTIMEVERIFY).
|
|
|
|
|
|
|
|
|
|
Test that the CHECKLOCKTIMEVERIFY soft-fork activates at (regtest) block height
|
|
|
|
|
1351.
|
|
|
|
|
Test that the CHECKLOCKTIMEVERIFY soft-fork activates.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
from test_framework.blocktools import (
|
|
|
|
@ -62,9 +61,9 @@ def cltv_invalidate(tx, failure_reason):
|
|
|
|
|
# +-------------------------------------------------+------------+--------------+
|
|
|
|
|
[[OP_CHECKLOCKTIMEVERIFY], None, None],
|
|
|
|
|
[[OP_1NEGATE, OP_CHECKLOCKTIMEVERIFY, OP_DROP], None, None],
|
|
|
|
|
[[CScriptNum(1000), OP_CHECKLOCKTIMEVERIFY, OP_DROP], 0, 1296688602], # timestamp of genesis block
|
|
|
|
|
[[CScriptNum(1000), OP_CHECKLOCKTIMEVERIFY, OP_DROP], 0, 500],
|
|
|
|
|
[[CScriptNum(500), OP_CHECKLOCKTIMEVERIFY, OP_DROP], 0xffffffff, 500],
|
|
|
|
|
[[CScriptNum(100), OP_CHECKLOCKTIMEVERIFY, OP_DROP], 0, 1296688602], # timestamp of genesis block
|
|
|
|
|
[[CScriptNum(100), OP_CHECKLOCKTIMEVERIFY, OP_DROP], 0, 50],
|
|
|
|
|
[[CScriptNum(50), OP_CHECKLOCKTIMEVERIFY, OP_DROP], 0xffffffff, 50],
|
|
|
|
|
][failure_reason]
|
|
|
|
|
|
|
|
|
|
cltv_modify_tx(tx, prepend_scriptsig=scheme[0], nsequence=scheme[1], nlocktime=scheme[2])
|
|
|
|
@ -105,6 +104,7 @@ class BIP65Test(BitcoinTestFramework):
|
|
|
|
|
self.log.info("Mining %d blocks", CLTV_HEIGHT - 2)
|
|
|
|
|
wallet.generate(10)
|
|
|
|
|
self.nodes[0].generate(CLTV_HEIGHT - 2 - 10)
|
|
|
|
|
assert_equal(self.nodes[0].getblockcount(), CLTV_HEIGHT - 2)
|
|
|
|
|
|
|
|
|
|
self.log.info("Test that invalid-according-to-CLTV transactions can still appear in a block")
|
|
|
|
|
|
|
|
|
|