From 6d1f51343cf11b07cd401fbd0c5bc3603e185a0e Mon Sep 17 00:00:00 2001 From: Sjors Provoost Date: Fri, 7 Aug 2020 13:53:51 +0200 Subject: [rpc] fundrawtransaction, walletcreatefundedpsbt lock manually selected coins Previously only automatically selected coins were locked when lockUnspents is set. It now also locks selected coins. --- test/functional/wallet_basic.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'test/functional/wallet_basic.py') diff --git a/test/functional/wallet_basic.py b/test/functional/wallet_basic.py index 81382d94ad..7f891deabf 100755 --- a/test/functional/wallet_basic.py +++ b/test/functional/wallet_basic.py @@ -136,11 +136,19 @@ class WalletTest(BitcoinTestFramework): self.nodes[2].lockunspent, False, [{"txid": unspent_0["txid"], "vout": 999}]) - # An output should be unlocked when spent + # The lock on a manually selected output is ignored unspent_0 = self.nodes[1].listunspent()[0] self.nodes[1].lockunspent(False, [unspent_0]) tx = self.nodes[1].createrawtransaction([unspent_0], { self.nodes[1].getnewaddress() : 1 }) - tx = self.nodes[1].fundrawtransaction(tx)['hex'] + self.nodes[1].fundrawtransaction(tx,{"lockUnspents": True}) + + # fundrawtransaction can lock an input + self.nodes[1].lockunspent(True, [unspent_0]) + assert_equal(len(self.nodes[1].listlockunspent()), 0) + tx = self.nodes[1].fundrawtransaction(tx,{"lockUnspents": True})['hex'] + assert_equal(len(self.nodes[1].listlockunspent()), 1) + + # Send transaction tx = self.nodes[1].signrawtransactionwithwallet(tx)["hex"] self.nodes[1].sendrawtransaction(tx) assert_equal(len(self.nodes[1].listlockunspent()), 0) -- cgit v1.2.3