Return index to output of txid with value amount Raises exception if there is none.
(node, txid, amount, *, blockhash=None)
| 490 | |
| 491 | |
| 492 | def 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 |