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

Function find_vout_for_address

test/functional/test_framework/util.py:614–628  ·  view source on GitHub ↗

Locate the vout index of the given transaction sending to the given address. Raises runtime error exception if not found.

(node, txid, addr)

Source from the content-addressed store, hash-verified

612
613
614def find_vout_for_address(node, txid, addr):
615 """
616 Locate the vout index of the given transaction sending to the
617 given address. Raises runtime error exception if not found.
618 """
619 tx = node.getrawtransaction(txid, True)
620 unblind_addr = addr
621 if node.getblockchaininfo()['chain'] == 'elementsregtest':
622 unblind_addr = node.validateaddress(addr)["unconfidential"]
623 for i in range(len(tx["vout"])):
624 if tx["vout"][i]["scriptPubKey"]["type"] == "fee":
625 continue
626 if unblind_addr == tx["vout"][i]["scriptPubKey"]["address"]:
627 return i
628 raise RuntimeError("Vout not found for address: txid=%s, addr=%s" % (txid, addr))
629
630def modinv(a, n):
631 """Compute the modular inverse of a modulo n using the extended Euclidean

Callers 14

test_change_positionMethod · 0.90
test_include_unsafeMethod · 0.90
run_testMethod · 0.90
run_testMethod · 0.90
run_ca_testsMethod · 0.90
run_testMethod · 0.90
test_signing_with_csvMethod · 0.90

Calls

no outgoing calls