Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/util.py
Show First 20 Lines • Show All 627 Lines • ▼ Show 20 Lines | for _ in range(num): | ||||
newtx = rawtx[0:92] | newtx = rawtx[0:92] | ||||
newtx = newtx + txouts | newtx = newtx + txouts | ||||
newtx = newtx + rawtx[94:] | newtx = newtx + rawtx[94:] | ||||
signresult = node.signrawtransactionwithwallet( | signresult = node.signrawtransactionwithwallet( | ||||
newtx, None, "NONE|FORKID") | newtx, None, "NONE|FORKID") | ||||
txid = node.sendrawtransaction(signresult["hex"], True) | txid = node.sendrawtransaction(signresult["hex"], True) | ||||
txids.append(txid) | txids.append(txid) | ||||
return txids | return txids | ||||
def find_vout_for_address(node, txid, addr): | |||||
""" | |||||
Locate the vout index of the given transaction sending to the | |||||
given address. Raises runtime error exception if not found. | |||||
""" | |||||
tx = node.getrawtransaction(txid, True) | |||||
for i in range(len(tx["vout"])): | |||||
if any([addr == a for a in tx["vout"][i]["scriptPubKey"]["addresses"]]): | |||||
return i | |||||
raise RuntimeError( | |||||
"Vout not found for address: txid={}, addr={}".format(txid, addr)) |