Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/util.py
Show First 20 Lines • Show All 546 Lines • ▼ Show 20 Lines | |||||
# to make it large (helper for constructing large transactions). | # to make it large (helper for constructing large transactions). | ||||
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) | ||||
# create one script_pubkey | # create one script_pubkey | ||||
script_pubkey = "6a4d0200" # OP_RETURN OP_PUSH2 512 bytes | script_pubkey = "6a4d0200" # OP_RETURN OP_PUSH2 512 bytes | ||||
for i in range(512): | for _ in range(512): | ||||
script_pubkey = script_pubkey + "01" | script_pubkey = script_pubkey + "01" | ||||
# concatenate 128 txouts of above script_pubkey which we'll insert before | # concatenate 128 txouts of above script_pubkey which we'll insert before | ||||
# the txout for change | # the txout for change | ||||
txouts = [] | txouts = [] | ||||
from .messages import CTxOut | from .messages import CTxOut | ||||
txout = CTxOut() | txout = CTxOut() | ||||
txout.nValue = 0 | txout.nValue = 0 | ||||
txout.scriptPubKey = hex_str_to_bytes(script_pubkey) | txout.scriptPubKey = hex_str_to_bytes(script_pubkey) | ||||
for k in range(128): | for _ in range(128): | ||||
txouts.append(txout) | txouts.append(txout) | ||||
return txouts | return txouts | ||||
# Create a spend of each passed-in utxo, splicing in "txouts" to each raw | # Create a spend of each passed-in utxo, splicing in "txouts" to each raw | ||||
# transaction to make it large. See gen_return_txouts() above. | # transaction to make it large. See gen_return_txouts() above. | ||||
def create_lots_of_big_transactions(node, txouts, utxos, num, fee): | def create_lots_of_big_transactions(node, txouts, utxos, num, fee): | ||||
Show All 33 Lines |