mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-12 13:52:36 +02:00
Use COINBASE_MATURITY constant in functional tests.
This commit is contained in:
@ -9,7 +9,12 @@ Version 2 compact blocks are post-segwit (wtxids)
|
||||
"""
|
||||
import random
|
||||
|
||||
from test_framework.blocktools import create_block, NORMAL_GBT_REQUEST_PARAMS, add_witness_commitment
|
||||
from test_framework.blocktools import (
|
||||
COINBASE_MATURITY,
|
||||
NORMAL_GBT_REQUEST_PARAMS,
|
||||
add_witness_commitment,
|
||||
create_block,
|
||||
)
|
||||
from test_framework.messages import BlockTransactions, BlockTransactionsRequest, calculate_shortid, CBlock, CBlockHeader, CInv, COutPoint, CTransaction, CTxIn, CTxInWitness, CTxOut, FromHex, HeaderAndShortIDs, msg_no_witness_block, msg_no_witness_blocktxn, msg_cmpctblock, msg_getblocktxn, msg_getdata, msg_getheaders, msg_headers, msg_inv, msg_sendcmpct, msg_sendheaders, msg_tx, msg_block, msg_blocktxn, MSG_BLOCK, MSG_CMPCT_BLOCK, MSG_WITNESS_FLAG, NODE_NETWORK, P2PHeaderAndShortIDs, PrefilledTransaction, ser_uint256, ToHex
|
||||
from test_framework.p2p import p2p_lock, P2PInterface
|
||||
from test_framework.script import CScript, OP_TRUE, OP_DROP
|
||||
@ -115,7 +120,7 @@ class CompactBlocksTest(BitcoinTestFramework):
|
||||
block = self.build_block_on_tip(self.nodes[0])
|
||||
self.segwit_node.send_and_ping(msg_no_witness_block(block))
|
||||
assert int(self.nodes[0].getbestblockhash(), 16) == block.sha256
|
||||
self.nodes[0].generatetoaddress(100, self.nodes[0].getnewaddress(address_type="bech32"))
|
||||
self.nodes[0].generatetoaddress(COINBASE_MATURITY, self.nodes[0].getnewaddress(address_type="bech32"))
|
||||
|
||||
total_value = block.vtx[0].vout[0].nValue
|
||||
out_value = total_value // 10
|
||||
@ -226,7 +231,7 @@ class CompactBlocksTest(BitcoinTestFramework):
|
||||
|
||||
# This test actually causes bitcoind to (reasonably!) disconnect us, so do this last.
|
||||
def test_invalid_cmpctblock_message(self):
|
||||
self.nodes[0].generate(101)
|
||||
self.nodes[0].generate(COINBASE_MATURITY + 1)
|
||||
block = self.build_block_on_tip(self.nodes[0])
|
||||
|
||||
cmpct_block = P2PHeaderAndShortIDs()
|
||||
@ -244,7 +249,7 @@ class CompactBlocksTest(BitcoinTestFramework):
|
||||
version = test_node.cmpct_version
|
||||
node = self.nodes[0]
|
||||
# Generate a bunch of transactions.
|
||||
node.generate(101)
|
||||
node.generate(COINBASE_MATURITY + 1)
|
||||
num_transactions = 25
|
||||
address = node.getnewaddress()
|
||||
|
||||
|
Reference in New Issue
Block a user