Skip to content

Commit fc25503

Browse files
laanwjknst
authored andcommitted
Merge 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@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@fafe896 Tree-SHA512: 4bbee3c8587d612e74a59fde49b6439c1296f2fc27d3a7cf59a35e920f729fdd581c930290bd04def618f81412236676ddb99b4ceb4d80dfb9fd610b128a04b1
1 parent cbd2be8 commit fc25503

File tree

5 files changed

+13
-5
lines changed

5 files changed

+13
-5
lines changed

doc/release-notes-6189.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Tests
2+
-----
3+
4+
- For the `regtest` network the BIP 66 (DERSIG) activation height was changed
5+
from 1251 to 102. (dash#6189)

src/chainparams.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,7 @@ class CRegTestParams : public CChainParams {
797797
consensus.BIP34Height = 500; // BIP34 activated on regtest (Used in functional tests)
798798
consensus.BIP34Hash = uint256();
799799
consensus.BIP65Height = 1351; // BIP65 activated on regtest (Used in functional tests)
800-
consensus.BIP66Height = 1251; // BIP66 activated on regtest (Used in functional tests)
800+
consensus.BIP66Height = 102; // BIP66 activated on regtest (Block at height 101 and earlier not enforced for testing purposes)
801801
consensus.BIP147Height = 432; // BIP147 activated on regtest (Used in functional tests)
802802
consensus.CSVHeight = 432; // CSV activated on regtest (Used in rpc activation tests)
803803
consensus.DIP0001Height = 2000;

test/functional/feature_dersig.py

+4-3
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
)
@@ -24,8 +25,6 @@
2425
MiniWalletMode,
2526
)
2627

27-
DERSIG_HEIGHT = 1251
28-
2928

3029
# A canonical signature consists of:
3130
# <30> <total len> <02> <len R> <R> <02> <len S> <S> <hashtype>
@@ -88,8 +87,10 @@ def run_test(self):
8887
block.rehash()
8988
block.solve()
9089

90+
assert_equal(self.nodes[0].getblockcount(), DERSIG_HEIGHT - 2)
9191
self.test_dersig_info(is_active=False) # Not active as of current tip and next block does not need to obey rules
9292
peer.send_and_ping(msg_block(block))
93+
assert_equal(self.nodes[0].getblockcount(), DERSIG_HEIGHT - 1)
9394
self.test_dersig_info(is_active=True) # Not active as of current tip, but next block must obey rules
9495
assert_equal(self.nodes[0].getbestblockhash(), block.hash)
9596

test/functional/rpc_blockchain.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

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

test/functional/test_framework/blocktools.py

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
COINBASE_MATURITY = 100
3737

3838
# Soft-fork activation heights
39+
DERSIG_HEIGHT = 102 # BIP 66
3940
CLTV_HEIGHT = 1351
4041
CSV_ACTIVATION_HEIGHT = 432
4142

0 commit comments

Comments
 (0)