From f319287d819cc97b5422248aacf447ca190e20f6 Mon Sep 17 00:00:00 2001 From: Sebastian Falbesoner Date: Wed, 29 Jun 2022 17:28:33 +0200 Subject: [PATCH] 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). --- test/functional/test_framework/util.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/functional/test_framework/util.py b/test/functional/test_framework/util.py index 6a588275ea..eab94c32d9 100644 --- a/test/functional/test_framework/util.py +++ b/test/functional/test_framework/util.py @@ -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 -# 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(): # 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) @@ -515,6 +516,7 @@ def gen_return_txouts(): txout.scriptPubKey = bytes.fromhex(script_pubkey) for _ in range(128): txouts.append(txout) + assert_equal(sum([len(txout.serialize()) for txout in txouts]), 67456) return txouts