From b1ba3ed155e89fb6e30237cba8bc8028c7906830 Mon Sep 17 00:00:00 2001 From: Sebastian Falbesoner Date: Wed, 29 Jun 2022 17:42:51 +0200 Subject: test: let `gen_return_txouts` create a single large OP_RETURN output Transactions with more than one datacarrier (OP_RETURN) output are never considered standard, i.e. this change is necessary in order to to get rid of the `acceptnonstdtxn` option for some tests. --- test/functional/test_framework/util.py | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'test/functional/test_framework') diff --git a/test/functional/test_framework/util.py b/test/functional/test_framework/util.py index eab94c32d9..1ee23f7574 100644 --- a/test/functional/test_framework/util.py +++ b/test/functional/test_framework/util.py @@ -502,20 +502,9 @@ def chain_transaction(node, parent_txids, vouts, value, fee, num_outputs): # 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) - # create one script_pubkey - script_pubkey = "6a4d0200" # OP_RETURN OP_PUSH2 512 bytes - for _ in range(512): - script_pubkey = script_pubkey + "01" - # concatenate 128 txouts of above script_pubkey which we'll insert before the txout for change - txouts = [] from .messages import CTxOut - txout = CTxOut() - txout.nValue = 0 - txout.scriptPubKey = bytes.fromhex(script_pubkey) - for _ in range(128): - txouts.append(txout) + from .script import CScript, OP_RETURN + txouts = [CTxOut(nValue=0, scriptPubKey=CScript([OP_RETURN, b'\x01'*67437]))] assert_equal(sum([len(txout.serialize()) for txout in txouts]), 67456) return txouts -- cgit v1.2.3