aboutsummaryrefslogtreecommitdiff
path: root/test/functional/p2p_unrequested_blocks.py
diff options
context:
space:
mode:
authorSebastian Falbesoner <sebastian.falbesoner@gmail.com>2021-11-15 18:29:13 +0100
committerSebastian Falbesoner <sebastian.falbesoner@gmail.com>2021-11-17 15:45:30 +0100
commitdf5d783aef3e5af2d1294fc8ff9470a5dc878325 (patch)
tree0004a7e5e021e9bc4d989b9c2e4cdc552404fb48 /test/functional/p2p_unrequested_blocks.py
parentae9df4ef937ef77405f6edd7c13615df7b63446f (diff)
downloadbitcoin-df5d783aef3e5af2d1294fc8ff9470a5dc878325.tar.xz
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.
Diffstat (limited to 'test/functional/p2p_unrequested_blocks.py')
-rwxr-xr-xtest/functional/p2p_unrequested_blocks.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/test/functional/p2p_unrequested_blocks.py b/test/functional/p2p_unrequested_blocks.py
index 3b02a1c61f..9c4e1dd1b1 100755
--- a/test/functional/p2p_unrequested_blocks.py
+++ b/test/functional/p2p_unrequested_blocks.py
@@ -225,10 +225,9 @@ class AcceptBlockTest(BitcoinTestFramework):
block_289f.solve()
block_290f = create_block(block_289f.sha256, create_coinbase(290), block_289f.nTime+1)
block_290f.solve()
- block_291 = create_block(block_290f.sha256, create_coinbase(291), block_290f.nTime+1)
# block_291 spends a coinbase below maturity!
- block_291.vtx.append(create_tx_with_script(block_290f.vtx[0], 0, script_sig=b"42", amount=1))
- block_291.hashMerkleRoot = block_291.calc_merkle_root()
+ tx_to_add = create_tx_with_script(block_290f.vtx[0], 0, script_sig=b"42", amount=1)
+ block_291 = create_block(block_290f.sha256, create_coinbase(291), block_290f.nTime+1, txlist=[tx_to_add])
block_291.solve()
block_292 = create_block(block_291.sha256, create_coinbase(292), block_291.nTime+1)
block_292.solve()