Skip to content

Commit 42b2fdf

Browse files
committed
test: remove unused create_confirmed_utxos helper
Confirmed UTXOs in functional tests can simply be created by using MiniWallet's `send_self_transfer_multi` method with a subsequent `generate` call to mine a block.
1 parent df93359 commit 42b2fdf

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)