Skip to content

Commit 0b5344b

Browse files
committed
Merge bitcoin/bitcoin#22632: test: Set regtest.BIP66Height = 102 to speed up tests
fafe896 test: Set regtest.BIP66Height = 102 to speed up tests (MarcoFalke) Pull request description: No need to waste time by forcing creation of more than 1000 blocks to get the benefits of being able to test BIP 66. Also, reducing the height makes it more likely that (third-party) tests are conforming to BIP 66, which is enforced on mainnet for all new blocks. ACKs for top commit: GeneFerneau: Concept + code review ACK [fafe896](bitcoin/bitcoin@fafe896) 0xB10C: crACK fafe896 laanwj: ACK fafe896 Zero-1729: tACK fafe896 kristapsk: ACK fafe896. Full functional test suite showed few second speed incrase on my laptop (although I didn't do proper benchmarking with multiple runs, just single `time ./test/functional/test_runner.py` on current master vs this PR). theStack: Tested ACK fafe896 hg333: tACK bitcoin/bitcoin@fafe896 Tree-SHA512: 4bbee3c8587d612e74a59fde49b6439c1296f2fc27d3a7cf59a35e920f729fdd581c930290bd04def618f81412236676ddb99b4ceb4d80dfb9fd610b128a04b1
2 parents ce09131 + fafe896 commit 0b5344b

File tree

5 files changed

+11
-5
lines changed

5 files changed

+11
-5
lines changed

doc/release-notes.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ RPC
108108
Tests
109109
-----
110110

111+
- For the `regtest` network the BIP 66 (DERSIG) activation height was changed
112+
from 1251 to 102. (#22632)
113+
111114
Credits
112115
=======
113116

src/chainparams.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ class CRegTestParams : public CChainParams {
393393
consensus.BIP34Height = 2; // BIP34 activated on regtest (Block at height 1 not enforced for testing purposes)
394394
consensus.BIP34Hash = uint256();
395395
consensus.BIP65Height = 1351; // BIP65 activated on regtest (Used in functional tests)
396-
consensus.BIP66Height = 1251; // BIP66 activated on regtest (Used in functional tests)
396+
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
399399
consensus.MinBIP9WarningHeight = 0;

test/functional/feature_dersig.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55
"""Test BIP66 (DER SIG).
66
7-
Test that the DERSIG soft-fork activates at (regtest) height 1251.
7+
Test the DERSIG soft-fork activation on regtest.
88
"""
99

1010
from test_framework.blocktools import (
11+
DERSIG_HEIGHT,
1112
create_block,
1213
create_coinbase,
1314
)
@@ -23,8 +24,6 @@
2324
MiniWalletMode,
2425
)
2526

26-
DERSIG_HEIGHT = 1251
27-
2827

2928
# A canonical signature consists of:
3029
# <30> <total len> <02> <len R> <R> <02> <len S> <S> <hashtype>
@@ -90,8 +89,10 @@ def run_test(self):
9089
block.rehash()
9190
block.solve()
9291

92+
assert_equal(self.nodes[0].getblockcount(), DERSIG_HEIGHT - 2)
9393
self.test_dersig_info(is_active=False) # Not active as of current tip and next block does not need to obey rules
9494
peer.send_and_ping(msg_block(block))
95+
assert_equal(self.nodes[0].getblockcount(), DERSIG_HEIGHT - 1)
9596
self.test_dersig_info(is_active=True) # Not active as of current tip, but next block must obey rules
9697
assert_equal(self.nodes[0].getbestblockhash(), block.hash)
9798

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+
DERSIG_HEIGHT,
3031
create_block,
3132
create_coinbase,
3233
TIME_GENESIS_BLOCK,
@@ -141,7 +142,7 @@ def _test_getblockchaininfo(self):
141142

142143
assert_equal(res['softforks'], {
143144
'bip34': {'type': 'buried', 'active': True, 'height': 2},
144-
'bip66': {'type': 'buried', 'active': False, 'height': 1251},
145+
'bip66': {'type': 'buried', 'active': True, 'height': DERSIG_HEIGHT},
145146
'bip65': {'type': 'buried', 'active': False, 'height': 1351},
146147
'csv': {'type': 'buried', 'active': False, 'height': 432},
147148
'segwit': {'type': 'buried', 'active': True, 'height': 0},

test/functional/test_framework/blocktools.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
COINBASE_MATURITY = 100
5555

5656
# Soft-fork activation heights
57+
DERSIG_HEIGHT = 102 # BIP 66
5758
CLTV_HEIGHT = 1351
5859
CSV_ACTIVATION_HEIGHT = 432
5960

0 commit comments

Comments
 (0)