aboutsummaryrefslogtreecommitdiff
path: root/test/functional/test_framework/util.py
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2018-05-09 10:12:45 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2018-05-09 10:13:16 +0200
commit1834d4d9f0af3e2fd364438d2a35465441d3b740 (patch)
treea5c8baccc847b6d90c3687c7c9b3e42b6726703e /test/functional/test_framework/util.py
parent9458b05f2834c00014ce03e294e41c4c3aa778f2 (diff)
parent891beb0f8a09810b179e39a680b579c2f6516db7 (diff)
downloadbitcoin-1834d4d9f0af3e2fd364438d2a35465441d3b740.tar.xz
Merge #12265: [test] fundrawtransaction: lock watch-only shared address
891beb0 [test] fundrawtransaction: lock watch-only shared address (Karl-Johan Alm) Pull request description: `self.nodes[0]` creates an address which is watch-only-shared with `self.nodes[3]`. If `nodes[0]` spends the associated UTXO during any of its sends later, the watchonly test will fail, as `nodes[3]` now has insufficient funds. I ran into this in #12257 and this commit is in that PR as well, but I figured I'd split it out (and remove from there once/if merged). Tree-SHA512: d04a04b1ecebe82127cccd47c1b3de311bf07f4b51dff80db20ea2f142e1d5c4a85ed6180c5c0b081d550e238c742e119b953f60f487deac5a3f3536e1a8d9fe
Diffstat (limited to 'test/functional/test_framework/util.py')
-rw-r--r--test/functional/test_framework/util.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/functional/test_framework/util.py b/test/functional/test_framework/util.py
index 4ec3175cd6..1daaa6c482 100644
--- a/test/functional/test_framework/util.py
+++ b/test/functional/test_framework/util.py
@@ -556,3 +556,14 @@ def mine_large_block(node, utxos=None):
fee = 100 * node.getnetworkinfo()["relayfee"]
create_lots_of_big_transactions(node, txouts, utxos, num, fee=fee)
node.generate(1)
+
+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=%s, addr=%s" % (txid, addr))