mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-10-11 03:53:22 +02:00
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.
This commit is contained in:
@@ -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)")
|
||||
|
Reference in New Issue
Block a user