mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-10-11 03:53:22 +02:00
test: refactor: take use of create_block
txlist parameter
Passing a list of transactions `txlist` to `create_block` appends them to the block, hence we don't need to do that manually anymore. The merkle root calculation can also be removed, since this is done in the end of the helper.
This commit is contained in:
@@ -1361,11 +1361,10 @@ class FullBlockTest(BitcoinTestFramework):
|
||||
else:
|
||||
coinbase.vout[0].nValue += spend.vout[0].nValue - 1 # all but one satoshi to fees
|
||||
coinbase.rehash()
|
||||
block = create_block(base_block_hash, coinbase, block_time, version=version)
|
||||
tx = self.create_tx(spend, 0, 1, script) # spend 1 satoshi
|
||||
self.sign_tx(tx, spend)
|
||||
self.add_transactions_to_block(block, [tx])
|
||||
block.hashMerkleRoot = block.calc_merkle_root()
|
||||
tx.rehash()
|
||||
block = create_block(base_block_hash, coinbase, block_time, version=version, txlist=[tx])
|
||||
# Block is created. Find a valid nonce.
|
||||
block.solve()
|
||||
self.tip = block
|
||||
|
Reference in New Issue
Block a user