Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/blocktools.py
Show All 15 Lines | from .script import ( | ||||
OP_EQUALVERIFY, | OP_EQUALVERIFY, | ||||
OP_HASH160, | OP_HASH160, | ||||
OP_RETURN, | OP_RETURN, | ||||
OP_TRUE, | OP_TRUE, | ||||
) | ) | ||||
from .messages import ( | from .messages import ( | ||||
CBlock, | CBlock, | ||||
COIN, | COIN, | ||||
XEC, | |||||
COutPoint, | COutPoint, | ||||
CTransaction, | CTransaction, | ||||
CTxIn, | CTxIn, | ||||
CTxOut, | CTxOut, | ||||
FromHex, | FromHex, | ||||
ToHex, | ToHex, | ||||
) | ) | ||||
from .txtools import pad_tx | from .txtools import pad_tx | ||||
▲ Show 20 Lines • Show All 179 Lines • ▼ Show 20 Lines | def send_big_transactions(node, utxos, num, fee_multiplier): | ||||
addrHash = decode(node.getnewaddress())[2] | addrHash = decode(node.getnewaddress())[2] | ||||
for _ in range(num): | for _ in range(num): | ||||
ctx = CTransaction() | ctx = CTransaction() | ||||
utxo = utxos.pop() | utxo = utxos.pop() | ||||
txid = int(utxo['txid'], 16) | txid = int(utxo['txid'], 16) | ||||
ctx.vin.append(CTxIn(COutPoint(txid, int(utxo["vout"])), b"")) | ctx.vin.append(CTxIn(COutPoint(txid, int(utxo["vout"])), b"")) | ||||
ctx.vout.append( | ctx.vout.append( | ||||
CTxOut(int(satoshi_round(utxo['amount'] * COIN)), | CTxOut(int(satoshi_round(utxo['amount'] * XEC)), | ||||
CScript([OP_DUP, OP_HASH160, addrHash, OP_EQUALVERIFY, OP_CHECKSIG]))) | CScript([OP_DUP, OP_HASH160, addrHash, OP_EQUALVERIFY, OP_CHECKSIG]))) | ||||
for i in range(0, 127): | for i in range(0, 127): | ||||
ctx.vout.append(CTxOut(0, CScript( | ctx.vout.append(CTxOut(0, CScript( | ||||
[OP_RETURN, bytes(padding, 'utf-8')]))) | [OP_RETURN, bytes(padding, 'utf-8')]))) | ||||
# Create a proper fee for the transaction to be mined | # Create a proper fee for the transaction to be mined | ||||
ctx.vout[0].nValue -= int(fee_multiplier * node.calculate_fee(ctx)) | ctx.vout[0].nValue -= int(fee_multiplier * node.calculate_fee(ctx)) | ||||
signresult = node.signrawtransactionwithwallet( | signresult = node.signrawtransactionwithwallet( | ||||
ToHex(ctx), None, "NONE|FORKID") | ToHex(ctx), None, "NONE|FORKID") | ||||
Show All 10 Lines |