mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-13 11:25:02 -05:00
tests: wallet_basic lock needed unspents
To avoid accidentally spending UTXOs that are needed later in the test, lock those UTXOs after they're creation.
This commit is contained in:
parent
b77885f13e
commit
2ad3b5d2ad
1 changed files with 4 additions and 0 deletions
|
@ -13,6 +13,7 @@ from test_framework.util import (
|
||||||
assert_equal,
|
assert_equal,
|
||||||
assert_fee_amount,
|
assert_fee_amount,
|
||||||
assert_raises_rpc_error,
|
assert_raises_rpc_error,
|
||||||
|
find_vout_for_address,
|
||||||
)
|
)
|
||||||
from test_framework.wallet_util import test_address
|
from test_framework.wallet_util import test_address
|
||||||
|
|
||||||
|
@ -427,6 +428,9 @@ class WalletTest(BitcoinTestFramework):
|
||||||
# 1. Send some coins to generate new UTXO
|
# 1. Send some coins to generate new UTXO
|
||||||
address_to_import = self.nodes[2].getnewaddress()
|
address_to_import = self.nodes[2].getnewaddress()
|
||||||
txid = self.nodes[0].sendtoaddress(address_to_import, 1)
|
txid = self.nodes[0].sendtoaddress(address_to_import, 1)
|
||||||
|
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.generate(self.nodes[0], 1)
|
self.generate(self.nodes[0], 1)
|
||||||
self.sync_all(self.nodes[0:3])
|
self.sync_all(self.nodes[0:3])
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue