aboutsummaryrefslogtreecommitdiff
path: root/test/functional/wallet_basic.py
diff options
context:
space:
mode:
authorSebastian Falbesoner <sebastian.falbesoner@gmail.com>2023-08-13 16:02:10 +0200
committerSebastian Falbesoner <sebastian.falbesoner@gmail.com>2023-10-24 11:13:51 +0200
commit73a339abc3c864461c8b8830e139c8ec51570243 (patch)
treea9ff47a204e234ecd78b85adcf88f8947015c7d2 /test/functional/wallet_basic.py
parentd724bb52910c4a4a7609d5e685740cd675dd25a7 (diff)
downloadbitcoin-73a339abc3c864461c8b8830e139c8ec51570243.tar.xz
test: refactor: support sending funds with outpoint result
This commit introduces a helper `create_outpoints` to execute the `send` RPC and immediately return the target address outpoints as UTXO dictionary in the common format, making the tests more readable and avoiding unnecessary duplication.
Diffstat (limited to 'test/functional/wallet_basic.py')
-rwxr-xr-xtest/functional/wallet_basic.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/test/functional/wallet_basic.py b/test/functional/wallet_basic.py
index 01149a0977..78bfa97212 100755
--- a/test/functional/wallet_basic.py
+++ b/test/functional/wallet_basic.py
@@ -18,7 +18,6 @@ from test_framework.util import (
assert_equal,
assert_fee_amount,
assert_raises_rpc_error,
- find_vout_for_address,
)
from test_framework.wallet_util import test_address
from test_framework.wallet import MiniWallet
@@ -471,10 +470,9 @@ class WalletTest(BitcoinTestFramework):
# Import address and private key to check correct behavior of spendable unspents
# 1. Send some coins to generate new UTXO
address_to_import = self.nodes[2].getnewaddress()
- txid = self.nodes[0].sendtoaddress(address_to_import, 1)
+ utxo = self.create_outpoints(self.nodes[0], outputs=[{address_to_import: 1}])[0]
self.sync_mempools(self.nodes[0:3])
- vout = find_vout_for_address(self.nodes[2], txid, address_to_import)
- self.nodes[2].lockunspent(False, [{"txid": txid, "vout": vout}])
+ self.nodes[2].lockunspent(False, [utxo])
self.generate(self.nodes[0], 1, sync_fun=lambda: self.sync_all(self.nodes[0:3]))
self.log.info("Test sendtoaddress with fee_rate param (explicit fee rate in sat/vB)")