diff options
author | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2022-04-12 21:53:02 +0200 |
---|---|---|
committer | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2022-04-16 21:15:29 +0200 |
commit | 8973eeb4124112a8cb7bb3d486780ac668b3e7bd (patch) | |
tree | 26d2572234a2080b4cb840df5900732d283ff5e2 /test/functional/test_framework | |
parent | 2b5a741e98f186e50d9fbe1ceadcc8b8c91547f7 (diff) | |
download | bitcoin-8973eeb4124112a8cb7bb3d486780ac668b3e7bd.tar.xz |
test: use MiniWallet for mining_prioritisetransaction.py
This test can now be run even with the Bitcoin Core wallet disabled.
Diffstat (limited to 'test/functional/test_framework')
-rw-r--r-- | test/functional/test_framework/util.py | 32 |
1 files changed, 15 insertions, 17 deletions
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 |