test: assert serialized txouts size of gen_return_txouts helper

This assures that changing the internals of the helper function
still leads to the expected outcome sizewise (preparation for the
next commit).
This commit is contained in:
Sebastian Falbesoner 2022-06-29 17:28:33 +02:00
parent cc22bd7f70
commit f319287d81

View file

@ -499,7 +499,8 @@ def chain_transaction(node, parent_txids, vouts, value, fee, num_outputs):
# Create large OP_RETURN txouts that can be appended to a transaction # Create large OP_RETURN txouts that can be appended to a transaction
# to make it large (helper for constructing large transactions). # to make it large (helper for constructing large transactions). The
# total serialized size of the txouts is about 66k vbytes.
def gen_return_txouts(): def gen_return_txouts():
# Some pre-processing to create a bunch of OP_RETURN txouts to insert into transactions we create # Some pre-processing to create a bunch of OP_RETURN txouts to insert into transactions we create
# So we have big transactions (and therefore can't fit very many into each block) # So we have big transactions (and therefore can't fit very many into each block)
@ -515,6 +516,7 @@ def gen_return_txouts():
txout.scriptPubKey = bytes.fromhex(script_pubkey) txout.scriptPubKey = bytes.fromhex(script_pubkey)
for _ in range(128): for _ in range(128):
txouts.append(txout) txouts.append(txout)
assert_equal(sum([len(txout.serialize()) for txout in txouts]), 67456)
return txouts return txouts