From 8973eeb4124112a8cb7bb3d486780ac668b3e7bd Mon Sep 17 00:00:00 2001 From: Sebastian Falbesoner Date: Tue, 12 Apr 2022 21:53:02 +0200 Subject: test: use MiniWallet for mining_prioritisetransaction.py This test can now be run even with the Bitcoin Core wallet disabled. --- test/functional/test_framework/util.py | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) (limited to 'test/functional/test_framework') diff --git a/test/functional/test_framework/util.py b/test/functional/test_framework/util.py index 8651bcf636..db59e70bf7 100644 --- a/test/functional/test_framework/util.py +++ b/test/functional/test_framework/util.py @@ -552,24 +552,22 @@ def gen_return_txouts(): # Create a spend of each passed-in utxo, splicing in "txouts" to each raw # transaction to make it large. See gen_return_txouts() above. -def create_lots_of_big_transactions(node, txouts, utxos, num, fee): - addr = node.getnewaddress() +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 = [] - from .messages import tx_from_hex - for _ in range(num): - t = utxos.pop() - inputs = [{"txid": t["txid"], "vout": t["vout"]}] - outputs = {} - change = t['amount'] - fee - outputs[addr] = satoshi_round(change) - rawtx = node.createrawtransaction(inputs, outputs) - tx = tx_from_hex(rawtx) - for txout in txouts: - tx.vout.append(txout) - newtx = tx.serialize().hex() - signresult = node.signrawtransactionwithwallet(newtx, None, "NONE") - txid = node.sendrawtransaction(signresult["hex"], 0) - txids.append(txid) + use_internal_utxos = utxos is None + for _ in range(tx_batch_size): + tx = mini_wallet.create_self_transfer( + from_node=node, + utxo_to_spend=None if use_internal_utxos else utxos.pop(), + fee_rate=0, + mempool_valid=False)['tx'] + tx.vout[0].nValue -= fee_sats + tx.vout.extend(txouts) + res = node.testmempoolaccept([tx.serialize().hex()])[0] + assert_equal(res['fees']['base'], fee) + txids.append(node.sendrawtransaction(tx.serialize().hex())) return txids -- cgit v1.2.3