mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-05-31 08:13:52 +02:00
scripted-diff: Use new create_block height option
-BEGIN VERIFY SCRIPT-
# Replace single-arg create_coinbase calls ...
# ... followed by ntime arg
sed --in-place --regexp-extended 's/create_block\((.+), create_coinbase\(([^,]+)\), /create_block(\1, height=\2, ntime=/g' $( git grep -l 'create_block(' )
# ... not followed by any other args
sed --in-place --regexp-extended 's/create_block\((.+), create_coinbase\(([^,]+)\)\)/create_block(\1, height=\2)/g' $( git grep -l 'create_block(' )
-END VERIFY SCRIPT-
This commit is contained in:
@@ -50,7 +50,7 @@ class InvalidBlockRequestTest(BitcoinTestFramework):
|
||||
|
||||
self.log.info("Create a new block with an anyone-can-spend coinbase")
|
||||
|
||||
block = create_block(tip, create_coinbase(height), block_time)
|
||||
block = create_block(tip, height=height, ntime=block_time)
|
||||
block.solve()
|
||||
# Save the coinbase for later
|
||||
block1 = block
|
||||
@@ -74,7 +74,7 @@ class InvalidBlockRequestTest(BitcoinTestFramework):
|
||||
|
||||
tx1 = create_tx_with_script(block1.vtx[0], 0, script_sig=bytes([OP_TRUE]), amount=50 * COIN)
|
||||
tx2 = create_tx_with_script(tx1, 0, script_sig=bytes([OP_TRUE]), amount=50 * COIN)
|
||||
block2 = create_block(tip, create_coinbase(height), block_time, txlist=[tx1, tx2])
|
||||
block2 = create_block(tip, height=height, ntime=block_time, txlist=[tx1, tx2])
|
||||
block_time += 1
|
||||
block2.solve()
|
||||
orig_hash = block2.hash_int
|
||||
@@ -121,7 +121,7 @@ class InvalidBlockRequestTest(BitcoinTestFramework):
|
||||
# Create a block that spends the output of a tx in a previous block.
|
||||
tx3 = create_tx_with_script(tx2, 0, script_sig=bytes([OP_TRUE]), amount=50 * COIN)
|
||||
tx3.vin.append(tx3.vin[0]) # Duplicates input
|
||||
block4 = create_block(tip, create_coinbase(height), block_time, txlist=[tx3])
|
||||
block4 = create_block(tip, height=height, ntime=block_time, txlist=[tx3])
|
||||
block4.solve()
|
||||
self.log.info("Test inflation by duplicating input")
|
||||
peer.send_blocks_and_test([block4], node, success=False, reject_reason='bad-txns-inputs-duplicate')
|
||||
@@ -130,7 +130,7 @@ class InvalidBlockRequestTest(BitcoinTestFramework):
|
||||
t = int(time.time())
|
||||
node.setmocktime(t)
|
||||
# Set block time +1 second past max future validity
|
||||
block = create_block(tip, create_coinbase(height), t + MAX_FUTURE_BLOCK_TIME + 1)
|
||||
block = create_block(tip, height=height, ntime=t + MAX_FUTURE_BLOCK_TIME + 1)
|
||||
block.solve()
|
||||
# Need force_send because the block will get rejected without a getdata otherwise
|
||||
peer.send_blocks_and_test([block], node, force_send=True, success=False, reject_reason='time-too-new')
|
||||
|
||||
Reference in New Issue
Block a user