mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-30 15:58:24 +01:00
test: refactor: pass absolute fee in create_lots_of_big_transactions helper
This commit is contained in:
@@ -512,16 +512,13 @@ def gen_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(mini_wallet, node, fee, tx_batch_size, txouts, utxos=None):
|
def create_lots_of_big_transactions(mini_wallet, node, fee, tx_batch_size, txouts, utxos=None):
|
||||||
from .messages import COIN
|
|
||||||
fee_sats = int(fee * COIN)
|
|
||||||
txids = []
|
txids = []
|
||||||
use_internal_utxos = utxos is None
|
use_internal_utxos = utxos is None
|
||||||
for _ in range(tx_batch_size):
|
for _ in range(tx_batch_size):
|
||||||
tx = mini_wallet.create_self_transfer(
|
tx = mini_wallet.create_self_transfer(
|
||||||
utxo_to_spend=None if use_internal_utxos else utxos.pop(),
|
utxo_to_spend=None if use_internal_utxos else utxos.pop(),
|
||||||
fee_rate=0,
|
fee=fee,
|
||||||
)["tx"]
|
)["tx"]
|
||||||
tx.vout[0].nValue -= fee_sats
|
|
||||||
tx.vout.extend(txouts)
|
tx.vout.extend(txouts)
|
||||||
res = node.testmempoolaccept([tx.serialize().hex()])[0]
|
res = node.testmempoolaccept([tx.serialize().hex()])[0]
|
||||||
assert_equal(res['fees']['base'], fee)
|
assert_equal(res['fees']['base'], fee)
|
||||||
|
|||||||
Reference in New Issue
Block a user