Skip to content

Commit 4c0d1fe

Browse files
author
MacroFake
committed
Merge bitcoin/bitcoin#25374: test: remove unused create_confirmed_utxos helper
42b2fdf test: remove unused `create_confirmed_utxos` helper (Sebastian Falbesoner) Pull request description: After more and more non-wallet tests have been converted to use MiniWallet (#25087, #24839, #24749 etc.), the `create_confirmed_utxos` helper is now not used anymore and can be removed. An alternative would be to create a MiniWallet version of `create_confirmed_utxos`, but it seems that it's not worth it, considering that would be only two lines (calling MiniWallet's `send_self_transfer_multi` with a subsequent `generate` call), see comment bitcoin/bitcoin#24839 (comment). ACKs for top commit: MarcoFalke: cr ACK 42b2fdf Tree-SHA512: 274418156265a6071940f53cbcd77f6779af5e951cfa1e5efbf07a5c61487b521ee19f36b4105e5c0a808139d121e5e262e77525ea3d1486a0421f01abcf58fd
2 parents a57492f + 42b2fdf commit 4c0d1fe

File tree

1 file changed

+0
-33
lines changed
  • test/functional/test_framework

1 file changed

+0
-33
lines changed

test/functional/test_framework/util.py

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -476,39 +476,6 @@ def find_output(node, txid, amount, *, blockhash=None):
476476
raise RuntimeError("find_output txid %s : %s not found" % (txid, str(amount)))
477477

478478

479-
# Helper to create at least "count" utxos
480-
# Pass in a fee that is sufficient for relay and mining new transactions.
481-
def create_confirmed_utxos(test_framework, fee, node, count, **kwargs):
482-
to_generate = int(0.5 * count) + 101
483-
while to_generate > 0:
484-
test_framework.generate(node, min(25, to_generate), **kwargs)
485-
to_generate -= 25
486-
utxos = node.listunspent()
487-
iterations = count - len(utxos)
488-
addr1 = node.getnewaddress()
489-
addr2 = node.getnewaddress()
490-
if iterations <= 0:
491-
return utxos
492-
for _ in range(iterations):
493-
t = utxos.pop()
494-
inputs = []
495-
inputs.append({"txid": t["txid"], "vout": t["vout"]})
496-
outputs = {}
497-
send_value = t['amount'] - fee
498-
outputs[addr1] = satoshi_round(send_value / 2)
499-
outputs[addr2] = satoshi_round(send_value / 2)
500-
raw_tx = node.createrawtransaction(inputs, outputs)
501-
signed_tx = node.signrawtransactionwithwallet(raw_tx)["hex"]
502-
node.sendrawtransaction(signed_tx)
503-
504-
while (node.getmempoolinfo()['size'] > 0):
505-
test_framework.generate(node, 1, **kwargs)
506-
507-
utxos = node.listunspent()
508-
assert len(utxos) >= count
509-
return utxos
510-
511-
512479
def chain_transaction(node, parent_txids, vouts, value, fee, num_outputs):
513480
"""Build and send a transaction that spends the given inputs (specified
514481
by lists of parent_txid:vout each), with the desired total value and fee,

0 commit comments

Comments
 (0)