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 .cdefs import MIN_TX_SIZE, MAX_TXOUT_PUBKEY_SCRIPT | ||||
from .mininode import CTransaction, FromHex, ToHex, CTxOut | from .mininode import CTransaction, FromHex, ToHex, CTxOut | ||||
from .script import OP_RETURN, CScript | from .script import OP_RETURN, CScript | ||||
import random | import random | ||||
from binascii import hexlify, unhexlify | |||||
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()) | ||||
▲ Show 20 Lines • Show All 57 Lines • Show Last 20 Lines |