Skip to content

Commit b1ba3ed

Browse files
committed
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.
1 parent f319287 commit b1ba3ed

File tree

1 file changed

+2
-13
lines changed
  • test/functional/test_framework

1 file changed

+2
-13
lines changed

test/functional/test_framework/util.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -502,20 +502,9 @@ def chain_transaction(node, parent_txids, vouts, value, fee, num_outputs):
502502
# to make it large (helper for constructing large transactions). The
503503
# total serialized size of the txouts is about 66k vbytes.
504504
def gen_return_txouts():
505-
# Some pre-processing to create a bunch of OP_RETURN txouts to insert into transactions we create
506-
# So we have big transactions (and therefore can't fit very many into each block)
507-
# create one script_pubkey
508-
script_pubkey = "6a4d0200" # OP_RETURN OP_PUSH2 512 bytes
509-
for _ in range(512):
510-
script_pubkey = script_pubkey + "01"
511-
# concatenate 128 txouts of above script_pubkey which we'll insert before the txout for change
512-
txouts = []
513505
from .messages import CTxOut
514-
txout = CTxOut()
515-
txout.nValue = 0
516-
txout.scriptPubKey = bytes.fromhex(script_pubkey)
517-
for _ in range(128):
518-
txouts.append(txout)
506+
from .script import CScript, OP_RETURN
507+
txouts = [CTxOut(nValue=0, scriptPubKey=CScript([OP_RETURN, b'\x01'*67437]))]
519508
assert_equal(sum([len(txout.serialize()) for txout in txouts]), 67456)
520509
return txouts
521510

0 commit comments

Comments
 (0)