aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2021-09-28 09:49:36 +0200
committerMarcoFalke <falke.marco@gmail.com>2021-09-28 09:49:44 +0200
commita9d0cec4991ab057557af9992daa4c8146a9b9d0 (patch)
treefaf6bfe318cd71bd93278d2ce935af2a5ad103f3 /test
parenta8bbd4cc819633ec50ed0f763b6a75330ae055fb (diff)
parent7e3ee4cdd0f60a2f549ba030fe96b90d61c036c5 (diff)
downloadbitcoin-a9d0cec4991ab057557af9992daa4c8146a9b9d0.tar.xz
Merge bitcoin/bitcoin#23106: Ensure wallet is unlocked before signing PSBT with walletprocesspsbt and GUI
7e3ee4cdd0f60a2f549ba030fe96b90d61c036c5 GUI: Ask user to unlock wallet before signing psbt (Samuel Dobson) 0f3acecf3372f9da143590bb17d8444564e083f4 Add test that walletprocesspsbt requires unlocked wallet when signing (Samuel Dobson) 0e895212bb571ae0de5580adfd8ee9b3c2137e24 Ensure wallet is unlocked before signing in walletprocesspsbt (Samuel Dobson) Pull request description: If signing a PSBT, we need to ensure the wallet is unlocked. Fixes #22874, fixes bitcoin-core/gui#312 ACKs for top commit: achow101: ACK 7e3ee4cdd0f60a2f549ba030fe96b90d61c036c5 lsilva01: Code Review ACK https://github.com/bitcoin/bitcoin/pull/23106/commits/7e3ee4cdd0f60a2f549ba030fe96b90d61c036c5 benthecarman: ACK 7e3ee4cdd0f60a2f549ba030fe96b90d61c036c5 Tree-SHA512: 6726a873582747900ab454ea21153a92be86808a4c1517dc2856b389876a2da9e8df1ffa9b567b6bd017038342c3544ecf5ca3c97744e7debe0a5ee65563687d
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/rpc_psbt.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/functional/rpc_psbt.py b/test/functional/rpc_psbt.py
index 2b1892c121..f330bbf1c3 100755
--- a/test/functional/rpc_psbt.py
+++ b/test/functional/rpc_psbt.py
@@ -108,6 +108,16 @@ class PSBTTest(BitcoinTestFramework):
psbtx = self.nodes[1].walletprocesspsbt(psbtx1)['psbt']
assert_equal(psbtx1, psbtx)
+ # Node 0 should not be able to sign the transaction with the wallet is locked
+ self.nodes[0].encryptwallet("password")
+ assert_raises_rpc_error(-13, "Please enter the wallet passphrase with walletpassphrase first", self.nodes[0].walletprocesspsbt, psbtx)
+
+ # Node 0 should be able to process without signing though
+ unsigned_tx = self.nodes[0].walletprocesspsbt(psbtx, False)
+ assert_equal(unsigned_tx['complete'], False)
+
+ self.nodes[0].walletpassphrase(passphrase="password", timeout=1000000)
+
# Sign the transaction and send
signed_tx = self.nodes[0].walletprocesspsbt(psbtx)['psbt']
final_tx = self.nodes[0].finalizepsbt(signed_tx)['hex']