Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/txtools.py
from .cdefs import MIN_TX_SIZE, MAX_TXOUT_PUBKEY_SCRIPT | |||||
from .mininode import CTransaction, FromHex, ToHex, CTxOut | |||||
from .script import OP_RETURN, CScript | |||||
import random | import random | ||||
from .cdefs import MAX_TXOUT_PUBKEY_SCRIPT, MIN_TX_SIZE | |||||
from .messages import CTransaction, CTxOut, FromHex, ToHex | |||||
from .script import CScript, OP_RETURN | |||||
def pad_tx(tx, pad_to_size=MIN_TX_SIZE): | def pad_tx(tx, pad_to_size=MIN_TX_SIZE): | ||||
""" | """ | ||||
Pad a transaction with op_return junk data until it is at least pad_to_size, or | Pad a transaction with op_return junk data until it is at least pad_to_size, or | ||||
leave it alone if it's already bigger than that. | leave it alone if it's already bigger than that. | ||||
""" | """ | ||||
curr_size = len(tx.serialize()) | curr_size = len(tx.serialize()) | ||||
if curr_size >= pad_to_size: | if curr_size >= pad_to_size: | ||||
▲ Show 20 Lines • Show All 56 Lines • Show Last 20 Lines |