mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-05 14:06:27 -05:00
test: use constants for CSV/CLTV activation heights in rpc_signrawtransaction
This commit is contained in:
parent
746f203f19
commit
12f094ec21
4 changed files with 13 additions and 6 deletions
|
@ -9,6 +9,7 @@ Test that the CHECKLOCKTIMEVERIFY soft-fork activates at (regtest) block height
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from test_framework.blocktools import (
|
from test_framework.blocktools import (
|
||||||
|
CLTV_HEIGHT,
|
||||||
create_block,
|
create_block,
|
||||||
create_coinbase,
|
create_coinbase,
|
||||||
)
|
)
|
||||||
|
@ -31,8 +32,6 @@ from test_framework.wallet import (
|
||||||
MiniWalletMode,
|
MiniWalletMode,
|
||||||
)
|
)
|
||||||
|
|
||||||
CLTV_HEIGHT = 1351
|
|
||||||
|
|
||||||
|
|
||||||
# Helper function to modify a transaction by
|
# Helper function to modify a transaction by
|
||||||
# 1) prepending a given script to the scriptSig of vin 0 and
|
# 1) prepending a given script to the scriptSig of vin 0 and
|
||||||
|
|
|
@ -41,6 +41,7 @@ from itertools import product
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from test_framework.blocktools import (
|
from test_framework.blocktools import (
|
||||||
|
CSV_ACTIVATION_HEIGHT,
|
||||||
create_block,
|
create_block,
|
||||||
create_coinbase,
|
create_coinbase,
|
||||||
)
|
)
|
||||||
|
@ -63,7 +64,6 @@ from test_framework.wallet import (
|
||||||
TESTING_TX_COUNT = 83 # Number of testing transactions: 1 BIP113 tx, 16 BIP68 txs, 66 BIP112 txs (see comments above)
|
TESTING_TX_COUNT = 83 # Number of testing transactions: 1 BIP113 tx, 16 BIP68 txs, 66 BIP112 txs (see comments above)
|
||||||
COINBASE_BLOCK_COUNT = TESTING_TX_COUNT # Number of coinbase blocks we need to generate as inputs for our txs
|
COINBASE_BLOCK_COUNT = TESTING_TX_COUNT # Number of coinbase blocks we need to generate as inputs for our txs
|
||||||
BASE_RELATIVE_LOCKTIME = 10
|
BASE_RELATIVE_LOCKTIME = 10
|
||||||
CSV_ACTIVATION_HEIGHT = 432
|
|
||||||
SEQ_DISABLE_FLAG = 1 << 31
|
SEQ_DISABLE_FLAG = 1 << 31
|
||||||
SEQ_RANDOM_HIGH_BIT = 1 << 25
|
SEQ_RANDOM_HIGH_BIT = 1 << 25
|
||||||
SEQ_TYPE_FLAG = 1 << 22
|
SEQ_TYPE_FLAG = 1 << 22
|
||||||
|
|
|
@ -4,7 +4,11 @@
|
||||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
"""Test transaction signing using the signrawtransaction* RPCs."""
|
"""Test transaction signing using the signrawtransaction* RPCs."""
|
||||||
|
|
||||||
from test_framework.blocktools import COINBASE_MATURITY
|
from test_framework.blocktools import (
|
||||||
|
CLTV_HEIGHT,
|
||||||
|
COINBASE_MATURITY,
|
||||||
|
CSV_ACTIVATION_HEIGHT,
|
||||||
|
)
|
||||||
from test_framework.address import (
|
from test_framework.address import (
|
||||||
script_to_p2sh,
|
script_to_p2sh,
|
||||||
script_to_p2wsh,
|
script_to_p2wsh,
|
||||||
|
@ -271,7 +275,7 @@ class SignRawTransactionsTest(BitcoinTestFramework):
|
||||||
getcontext().prec = 8
|
getcontext().prec = 8
|
||||||
|
|
||||||
# Make sure CSV is active
|
# Make sure CSV is active
|
||||||
generate_to_height(self.nodes[0], 500)
|
generate_to_height(self.nodes[0], CSV_ACTIVATION_HEIGHT)
|
||||||
assert self.nodes[0].getblockchaininfo()['softforks']['csv']['active']
|
assert self.nodes[0].getblockchaininfo()['softforks']['csv']['active']
|
||||||
|
|
||||||
# Create a P2WSH script with CSV
|
# Create a P2WSH script with CSV
|
||||||
|
@ -307,7 +311,7 @@ class SignRawTransactionsTest(BitcoinTestFramework):
|
||||||
getcontext().prec = 8
|
getcontext().prec = 8
|
||||||
|
|
||||||
# Make sure CLTV is active
|
# Make sure CLTV is active
|
||||||
generate_to_height(self.nodes[0], 1500)
|
generate_to_height(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
|
||||||
|
|
|
@ -55,6 +55,10 @@ TIME_GENESIS_BLOCK = 1296688602
|
||||||
# Coinbase transaction outputs can only be spent after this number of new blocks (network rule)
|
# Coinbase transaction outputs can only be spent after this number of new blocks (network rule)
|
||||||
COINBASE_MATURITY = 100
|
COINBASE_MATURITY = 100
|
||||||
|
|
||||||
|
# Soft-fork activation heights
|
||||||
|
CLTV_HEIGHT = 1351
|
||||||
|
CSV_ACTIVATION_HEIGHT = 432
|
||||||
|
|
||||||
# From BIP141
|
# From BIP141
|
||||||
WITNESS_COMMITMENT_HEADER = b"\xaa\x21\xa9\xed"
|
WITNESS_COMMITMENT_HEADER = b"\xaa\x21\xa9\xed"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue