diff --git a/test/functional/feature_block.py b/test/functional/feature_block.py index 2dfa568c5b..f4f15d293e 100755 --- a/test/functional/feature_block.py +++ b/test/functional/feature_block.py @@ -831,6 +831,7 @@ class FullBlockTest(BitcoinTestFramework): self.log.info("Reject a block with a transaction with a duplicate hash of a previous transaction (BIP30)") self.move_tip(60) b61 = self.next_block(61) + b61.vtx[0].nLockTime = 0 b61.vtx[0].vin[0].scriptSig = DUPLICATE_COINBASE_SCRIPT_SIG b61.vtx[0].rehash() b61 = self.update_block(61, []) @@ -853,6 +854,7 @@ class FullBlockTest(BitcoinTestFramework): b_spend_dup_cb = self.update_block('spend_dup_cb', [tx]) b_dup_2 = self.next_block('dup_2') + b_dup_2.vtx[0].nLockTime = 0 b_dup_2.vtx[0].vin[0].scriptSig = DUPLICATE_COINBASE_SCRIPT_SIG b_dup_2.vtx[0].rehash() b_dup_2 = self.update_block('dup_2', []) diff --git a/test/functional/mining_mainnet.py b/test/functional/mining_mainnet.py index 1a537cd416..4f95696f78 100755 --- a/test/functional/mining_mainnet.py +++ b/test/functional/mining_mainnet.py @@ -30,6 +30,7 @@ from test_framework.blocktools import ( from test_framework.messages import ( CBlock, + SEQUENCE_FINAL, ) import json @@ -61,6 +62,10 @@ class MiningMainnetTest(BitcoinTestFramework): block.nBits = DIFF_1_N_BITS block.nNonce = blocks['nonces'][height - 1] block.vtx = [create_coinbase(height=height, script_pubkey=bytes.fromhex(COINBASE_SCRIPT_PUBKEY), retarget_period=2016)] + # The alternate mainnet chain was mined with non-timelocked coinbase txs. + block.vtx[0].nLockTime = 0 + block.vtx[0].vin[0].nSequence = SEQUENCE_FINAL + block.vtx[0].rehash() block.hashMerkleRoot = block.calc_merkle_root() block.rehash() block_hex = block.serialize(with_witness=False).hex() diff --git a/test/functional/test_framework/blocktools.py b/test/functional/test_framework/blocktools.py index 8e61628557..c36fdb5c76 100644 --- a/test/functional/test_framework/blocktools.py +++ b/test/functional/test_framework/blocktools.py @@ -29,6 +29,7 @@ from .messages import ( tx_from_hex, uint256_from_compact, WITNESS_SCALE_FACTOR, + MAX_SEQUENCE_NONFINAL, ) from .script import ( CScript, @@ -151,7 +152,8 @@ def create_coinbase(height, pubkey=None, *, script_pubkey=None, extra_output_scr If extra_output_script is given, make a 0-value output to that script. This is useful to pad block weight/sigops as needed. """ coinbase = CTransaction() - coinbase.vin.append(CTxIn(COutPoint(0, 0xffffffff), script_BIP34_coinbase_height(height), SEQUENCE_FINAL)) + coinbase.nLockTime = height - 1 + coinbase.vin.append(CTxIn(COutPoint(0, 0xffffffff), script_BIP34_coinbase_height(height), MAX_SEQUENCE_NONFINAL)) coinbaseoutput = CTxOut() coinbaseoutput.nValue = nValue * COIN if nValue == 50: