aboutsummaryrefslogtreecommitdiff
path: root/test/functional/test_framework/test_framework.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/test_framework/test_framework.py')
-rwxr-xr-xtest/functional/test_framework/test_framework.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py
index 4e6d245b5f..70b3943478 100755
--- a/test/functional/test_framework/test_framework.py
+++ b/test/functional/test_framework/test_framework.py
@@ -30,6 +30,7 @@ from .util import (
PortSeed,
assert_equal,
check_json_precision,
+ find_vout_for_address,
get_datadir_path,
initialize_datadir,
p2p_port,
@@ -697,6 +698,22 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
sync_fun() if sync_fun else self.sync_all()
return blocks
+ def create_outpoints(self, node, *, outputs):
+ """Send funds to a given list of `{address: amount}` targets using the bitcoind
+ wallet and return the corresponding outpoints as a list of dictionaries
+ `[{"txid": txid, "vout": vout1}, {"txid": txid, "vout": vout2}, ...]`.
+ The result can be used to specify inputs for RPCs like `createrawtransaction`,
+ `createpsbt`, `lockunspent` etc."""
+ assert all(len(output.keys()) == 1 for output in outputs)
+ send_res = node.send(outputs)
+ assert send_res["complete"]
+ utxos = []
+ for output in outputs:
+ address = list(output.keys())[0]
+ vout = find_vout_for_address(node, send_res["txid"], address)
+ utxos.append({"txid": send_res["txid"], "vout": vout})
+ return utxos
+
def sync_blocks(self, nodes=None, wait=1, timeout=60):
"""
Wait until everybody has the same tip.