mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-01 16:31:33 +01:00
Set regtest.BIP65Height = 111 to speed up tests
This commit is contained in:
@@ -112,6 +112,7 @@ Tests
|
|||||||
changed.
|
changed.
|
||||||
* BIP 34 (blockheight in coinbase) from 500 to 2 (#16333)
|
* BIP 34 (blockheight in coinbase) from 500 to 2 (#16333)
|
||||||
* BIP 66 (DERSIG) from 1251 to 102 (#22632)
|
* BIP 66 (DERSIG) from 1251 to 102 (#22632)
|
||||||
|
* BIP 65 (CLTV) from 1351 to 111 (#21862)
|
||||||
|
|
||||||
Credits
|
Credits
|
||||||
=======
|
=======
|
||||||
|
|||||||
@@ -392,7 +392,7 @@ public:
|
|||||||
consensus.BIP16Exception = uint256();
|
consensus.BIP16Exception = uint256();
|
||||||
consensus.BIP34Height = 2; // BIP34 activated on regtest (Block at height 1 not enforced for testing purposes)
|
consensus.BIP34Height = 2; // BIP34 activated on regtest (Block at height 1 not enforced for testing purposes)
|
||||||
consensus.BIP34Hash = uint256();
|
consensus.BIP34Hash = uint256();
|
||||||
consensus.BIP65Height = 1351; // BIP65 activated on regtest (Used in functional tests)
|
consensus.BIP65Height = 111; // BIP65 activated on regtest (Block at height 110 and earlier not enforced for testing purposes)
|
||||||
consensus.BIP66Height = 102; // BIP66 activated on regtest (Block at height 101 and earlier not enforced for testing purposes)
|
consensus.BIP66Height = 102; // BIP66 activated on regtest (Block at height 101 and earlier not enforced for testing purposes)
|
||||||
consensus.CSVHeight = 432; // CSV activated on regtest (Used in rpc activation tests)
|
consensus.CSVHeight = 432; // CSV activated on regtest (Used in rpc activation tests)
|
||||||
consensus.SegwitHeight = 0; // SEGWIT is always activated on regtest unless overridden
|
consensus.SegwitHeight = 0; // SEGWIT is always activated on regtest unless overridden
|
||||||
|
|||||||
@@ -4,8 +4,7 @@
|
|||||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
"""Test BIP65 (CHECKLOCKTIMEVERIFY).
|
"""Test BIP65 (CHECKLOCKTIMEVERIFY).
|
||||||
|
|
||||||
Test that the CHECKLOCKTIMEVERIFY soft-fork activates at (regtest) block height
|
Test that the CHECKLOCKTIMEVERIFY soft-fork activates.
|
||||||
1351.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from test_framework.blocktools import (
|
from test_framework.blocktools import (
|
||||||
@@ -62,9 +61,9 @@ def cltv_invalidate(tx, failure_reason):
|
|||||||
# +-------------------------------------------------+------------+--------------+
|
# +-------------------------------------------------+------------+--------------+
|
||||||
[[OP_CHECKLOCKTIMEVERIFY], None, None],
|
[[OP_CHECKLOCKTIMEVERIFY], None, None],
|
||||||
[[OP_1NEGATE, OP_CHECKLOCKTIMEVERIFY, OP_DROP], None, None],
|
[[OP_1NEGATE, OP_CHECKLOCKTIMEVERIFY, OP_DROP], None, None],
|
||||||
[[CScriptNum(1000), OP_CHECKLOCKTIMEVERIFY, OP_DROP], 0, 1296688602], # timestamp of genesis block
|
[[CScriptNum(100), OP_CHECKLOCKTIMEVERIFY, OP_DROP], 0, 1296688602], # timestamp of genesis block
|
||||||
[[CScriptNum(1000), OP_CHECKLOCKTIMEVERIFY, OP_DROP], 0, 500],
|
[[CScriptNum(100), OP_CHECKLOCKTIMEVERIFY, OP_DROP], 0, 50],
|
||||||
[[CScriptNum(500), OP_CHECKLOCKTIMEVERIFY, OP_DROP], 0xffffffff, 500],
|
[[CScriptNum(50), OP_CHECKLOCKTIMEVERIFY, OP_DROP], 0xffffffff, 50],
|
||||||
][failure_reason]
|
][failure_reason]
|
||||||
|
|
||||||
cltv_modify_tx(tx, prepend_scriptsig=scheme[0], nsequence=scheme[1], nlocktime=scheme[2])
|
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)
|
self.log.info("Mining %d blocks", CLTV_HEIGHT - 2)
|
||||||
wallet.generate(10)
|
wallet.generate(10)
|
||||||
self.nodes[0].generate(CLTV_HEIGHT - 2 - 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")
|
self.log.info("Test that invalid-according-to-CLTV transactions can still appear in a block")
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import subprocess
|
|||||||
|
|
||||||
from test_framework.address import ADDRESS_BCRT1_P2WSH_OP_TRUE
|
from test_framework.address import ADDRESS_BCRT1_P2WSH_OP_TRUE
|
||||||
from test_framework.blocktools import (
|
from test_framework.blocktools import (
|
||||||
|
CLTV_HEIGHT,
|
||||||
DERSIG_HEIGHT,
|
DERSIG_HEIGHT,
|
||||||
create_block,
|
create_block,
|
||||||
create_coinbase,
|
create_coinbase,
|
||||||
@@ -143,7 +144,7 @@ class BlockchainTest(BitcoinTestFramework):
|
|||||||
assert_equal(res['softforks'], {
|
assert_equal(res['softforks'], {
|
||||||
'bip34': {'type': 'buried', 'active': True, 'height': 2},
|
'bip34': {'type': 'buried', 'active': True, 'height': 2},
|
||||||
'bip66': {'type': 'buried', 'active': True, 'height': DERSIG_HEIGHT},
|
'bip66': {'type': 'buried', 'active': True, 'height': DERSIG_HEIGHT},
|
||||||
'bip65': {'type': 'buried', 'active': False, 'height': 1351},
|
'bip65': {'type': 'buried', 'active': True, 'height': CLTV_HEIGHT},
|
||||||
'csv': {'type': 'buried', 'active': False, 'height': 432},
|
'csv': {'type': 'buried', 'active': False, 'height': 432},
|
||||||
'segwit': {'type': 'buried', 'active': True, 'height': 0},
|
'segwit': {'type': 'buried', 'active': True, 'height': 0},
|
||||||
'testdummy': {
|
'testdummy': {
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
"""Test transaction signing using the signrawtransaction* RPCs."""
|
"""Test transaction signing using the signrawtransaction* RPCs."""
|
||||||
|
|
||||||
from test_framework.blocktools import (
|
from test_framework.blocktools import (
|
||||||
CLTV_HEIGHT,
|
|
||||||
COINBASE_MATURITY,
|
COINBASE_MATURITY,
|
||||||
CSV_ACTIVATION_HEIGHT,
|
CSV_ACTIVATION_HEIGHT,
|
||||||
)
|
)
|
||||||
@@ -310,11 +309,10 @@ class SignRawTransactionsTest(BitcoinTestFramework):
|
|||||||
getcontext().prec = 8
|
getcontext().prec = 8
|
||||||
|
|
||||||
# Make sure CLTV is active
|
# Make sure CLTV is active
|
||||||
generate_to_height(self, self.nodes[0], CLTV_HEIGHT)
|
|
||||||
assert self.nodes[0].getblockchaininfo()['softforks']['bip65']['active']
|
assert self.nodes[0].getblockchaininfo()['softforks']['bip65']['active']
|
||||||
|
|
||||||
# Create a P2WSH script with CLTV
|
# Create a P2WSH script with CLTV
|
||||||
script = CScript([1000, OP_CHECKLOCKTIMEVERIFY, OP_DROP])
|
script = CScript([100, OP_CHECKLOCKTIMEVERIFY, OP_DROP])
|
||||||
address = script_to_p2wsh(script)
|
address = script_to_p2wsh(script)
|
||||||
|
|
||||||
# Fund that address and make the spend
|
# Fund that address and make the spend
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ COINBASE_MATURITY = 100
|
|||||||
|
|
||||||
# Soft-fork activation heights
|
# Soft-fork activation heights
|
||||||
DERSIG_HEIGHT = 102 # BIP 66
|
DERSIG_HEIGHT = 102 # BIP 66
|
||||||
CLTV_HEIGHT = 1351
|
CLTV_HEIGHT = 111 # BIP 65
|
||||||
CSV_ACTIVATION_HEIGHT = 432
|
CSV_ACTIVATION_HEIGHT = 432
|
||||||
|
|
||||||
# From BIP141
|
# From BIP141
|
||||||
|
|||||||
Reference in New Issue
Block a user