MCPcopy Create free account
hub / github.com/ElementsProject/elements / find_output

Function find_output

test/functional/test_framework/util.py:492–501  ·  view source on GitHub ↗

Return index to output of txid with value amount Raises exception if there is none.

(node, txid, amount, *, blockhash=None)

Source from the content-addressed store, hash-verified

490
491
492def find_output(node, txid, amount, *, blockhash=None):
493 """
494 Return index to output of txid with value amount
495 Raises exception if there is none.
496 """
497 txdata = node.getrawtransaction(txid, 1, blockhash)
498 for i in range(len(txdata["vout"])):
499 if txdata["vout"][i].get("value") == amount:
500 return i
501 raise RuntimeError("find_output txid %s : %s not found" % (txid, str(amount)))
502
503
504# Helper to create at least "count" utxos

Callers 2

run_testMethod · 0.90
run_testMethod · 0.90

Calls 1

getMethod · 0.45

Tested by

no test coverage detected