Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/util.py
Show First 20 Lines • Show All 465 Lines • ▼ Show 20 Lines | while time.time() <= stop_time: | ||||
time.sleep(wait) | time.sleep(wait) | ||||
raise AssertionError("Mempool sync timed out:{}".format( | raise AssertionError("Mempool sync timed out:{}".format( | ||||
"".join("\n {!r}".format(m) for m in pool))) | "".join("\n {!r}".format(m) for m in pool))) | ||||
# Transaction/Block functions | # Transaction/Block functions | ||||
############################# | ############################# | ||||
def find_output(node, txid, amount): | def find_output(node, txid, amount, *, blockhash=None): | ||||
""" | """ | ||||
Return index to output of txid with value amount | Return index to output of txid with value amount | ||||
Raises exception if there is none. | Raises exception if there is none. | ||||
""" | """ | ||||
txdata = node.getrawtransaction(txid, 1) | txdata = node.getrawtransaction(txid, 1, blockhash) | ||||
for i in range(len(txdata["vout"])): | for i in range(len(txdata["vout"])): | ||||
if txdata["vout"][i]["value"] == amount: | if txdata["vout"][i]["value"] == amount: | ||||
return i | return i | ||||
raise RuntimeError("find_output txid {} : {} not found".format( | raise RuntimeError("find_output txid {} : {} not found".format( | ||||
txid, str(amount))) | txid, str(amount))) | ||||
def gather_inputs(from_node, amount_needed, confirmations_required=1): | def gather_inputs(from_node, amount_needed, confirmations_required=1): | ||||
▲ Show 20 Lines • Show All 115 Lines • Show Last 20 Lines |