diff --git a/test/functional/abc-p2p-compactblocks.py b/test/functional/abc-p2p-compactblocks.py --- a/test/functional/abc-p2p-compactblocks.py +++ b/test/functional/abc-p2p-compactblocks.py @@ -19,6 +19,7 @@ from test_framework.script import * from test_framework.cdefs import (ONE_MEGABYTE, LEGACY_MAX_BLOCK_SIZE, MAX_BLOCK_SIGOPS_PER_MB, MAX_TX_SIGOPS_COUNT) +from test_framework.txtools import pad_tx from collections import deque @@ -97,8 +98,10 @@ self.test.run() def add_transactions_to_block(self, block, tx_list): - [tx.rehash() for tx in tx_list] - block.vtx.extend(tx_list) + for tx in tx_list: + pad_tx(tx) + tx.rehash() + block.vtx += tx_list # this is a little handier to use than the version in blocktools.py def create_tx(self, spend_tx, n, value, script=CScript([OP_TRUE])): @@ -193,6 +196,9 @@ self.add_transactions_to_block(block, [tx]) current_block_size += len(tx.serialize()) + # Order transactions canonically + anomalyate_block(block) + # Now that we added a bunch of transaction, we need to recompute # the merkle root. block.hashMerkleRoot = block.calc_merkle_root() @@ -242,6 +248,7 @@ block = self.blocks[block_number] self.add_transactions_to_block(block, new_transactions) old_sha256 = block.sha256 + anomalyate_block(block) block.hashMerkleRoot = block.calc_merkle_root() block.solve() # Update the internal state just like in next_block