Skip to content

Commit faf7e48

Browse files
author
MarcoFalke
committed
Set regtest.BIP65Height = 111 to speed up tests
1 parent 718d9f2 commit faf7e48

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

doc/release-notes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ Tests
112112
changed.
113113
* BIP 34 (blockheight in coinbase) from 500 to 2 (#16333)
114114
* BIP 66 (DERSIG) from 1251 to 102 (#22632)
115+
* BIP 65 (CLTV) from 1351 to 111 (#21862)
115116

116117
Credits
117118
=======

src/chainparams.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ class CRegTestParams : public CChainParams {
392392
consensus.BIP16Exception = uint256();
393393
consensus.BIP34Height = 2; // BIP34 activated on regtest (Block at height 1 not enforced for testing purposes)
394394
consensus.BIP34Hash = uint256();
395-
consensus.BIP65Height = 1351; // BIP65 activated on regtest (Used in functional tests)
395+
consensus.BIP65Height = 111; // BIP65 activated on regtest (Block at height 110 and earlier not enforced for testing purposes)
396396
consensus.BIP66Height = 102; // BIP66 activated on regtest (Block at height 101 and earlier not enforced for testing purposes)
397397
consensus.CSVHeight = 432; // CSV activated on regtest (Used in rpc activation tests)
398398
consensus.SegwitHeight = 0; // SEGWIT is always activated on regtest unless overridden

test/functional/feature_cltv.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55
"""Test BIP65 (CHECKLOCKTIMEVERIFY).
66
7-
Test that the CHECKLOCKTIMEVERIFY soft-fork activates at (regtest) block height
8-
1351.
7+
Test that the CHECKLOCKTIMEVERIFY soft-fork activates.
98
"""
109

1110
from test_framework.blocktools import (
@@ -62,9 +61,9 @@ def cltv_invalidate(tx, failure_reason):
6261
# +-------------------------------------------------+------------+--------------+
6362
[[OP_CHECKLOCKTIMEVERIFY], None, None],
6463
[[OP_1NEGATE, OP_CHECKLOCKTIMEVERIFY, OP_DROP], None, None],
65-
[[CScriptNum(1000), OP_CHECKLOCKTIMEVERIFY, OP_DROP], 0, 1296688602], # timestamp of genesis block
66-
[[CScriptNum(1000), OP_CHECKLOCKTIMEVERIFY, OP_DROP], 0, 500],
67-
[[CScriptNum(500), OP_CHECKLOCKTIMEVERIFY, OP_DROP], 0xffffffff, 500],
64+
[[CScriptNum(100), OP_CHECKLOCKTIMEVERIFY, OP_DROP], 0, 1296688602], # timestamp of genesis block
65+
[[CScriptNum(100), OP_CHECKLOCKTIMEVERIFY, OP_DROP], 0, 50],
66+
[[CScriptNum(50), OP_CHECKLOCKTIMEVERIFY, OP_DROP], 0xffffffff, 50],
6867
][failure_reason]
6968

7069
cltv_modify_tx(tx, prepend_scriptsig=scheme[0], nsequence=scheme[1], nlocktime=scheme[2])
@@ -105,6 +104,7 @@ def run_test(self):
105104
self.log.info("Mining %d blocks", CLTV_HEIGHT - 2)
106105
wallet.generate(10)
107106
self.nodes[0].generate(CLTV_HEIGHT - 2 - 10)
107+
assert_equal(self.nodes[0].getblockcount(), CLTV_HEIGHT - 2)
108108

109109
self.log.info("Test that invalid-according-to-CLTV transactions can still appear in a block")
110110

test/functional/rpc_blockchain.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
from test_framework.address import ADDRESS_BCRT1_P2WSH_OP_TRUE
2929
from test_framework.blocktools import (
30+
CLTV_HEIGHT,
3031
DERSIG_HEIGHT,
3132
create_block,
3233
create_coinbase,
@@ -143,7 +144,7 @@ def _test_getblockchaininfo(self):
143144
assert_equal(res['softforks'], {
144145
'bip34': {'type': 'buried', 'active': True, 'height': 2},
145146
'bip66': {'type': 'buried', 'active': True, 'height': DERSIG_HEIGHT},
146-
'bip65': {'type': 'buried', 'active': False, 'height': 1351},
147+
'bip65': {'type': 'buried', 'active': True, 'height': CLTV_HEIGHT},
147148
'csv': {'type': 'buried', 'active': False, 'height': 432},
148149
'segwit': {'type': 'buried', 'active': True, 'height': 0},
149150
'testdummy': {

test/functional/rpc_signrawtransaction.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"""Test transaction signing using the signrawtransaction* RPCs."""
66

77
from test_framework.blocktools import (
8-
CLTV_HEIGHT,
98
COINBASE_MATURITY,
109
CSV_ACTIVATION_HEIGHT,
1110
)
@@ -310,11 +309,10 @@ def test_signing_with_cltv(self):
310309
getcontext().prec = 8
311310

312311
# Make sure CLTV is active
313-
generate_to_height(self, self.nodes[0], CLTV_HEIGHT)
314312
assert self.nodes[0].getblockchaininfo()['softforks']['bip65']['active']
315313

316314
# Create a P2WSH script with CLTV
317-
script = CScript([1000, OP_CHECKLOCKTIMEVERIFY, OP_DROP])
315+
script = CScript([100, OP_CHECKLOCKTIMEVERIFY, OP_DROP])
318316
address = script_to_p2wsh(script)
319317

320318
# Fund that address and make the spend

test/functional/test_framework/blocktools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555

5656
# Soft-fork activation heights
5757
DERSIG_HEIGHT = 102 # BIP 66
58-
CLTV_HEIGHT = 1351
58+
CLTV_HEIGHT = 111 # BIP 65
5959
CSV_ACTIVATION_HEIGHT = 432
6060

6161
# From BIP141

0 commit comments

Comments
 (0)