aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSamuel Dobson <dobsonsa68@gmail.com>2021-09-28 12:40:26 +1300
committerSamuel Dobson <dobsonsa68@gmail.com>2021-09-28 13:27:07 +1300
commit0f3acecf3372f9da143590bb17d8444564e083f4 (patch)
tree1f82272379f2352e5f39a90165c130b78e1db8cd /test
parent0e895212bb571ae0de5580adfd8ee9b3c2137e24 (diff)
downloadbitcoin-0f3acecf3372f9da143590bb17d8444564e083f4.tar.xz
Add test that walletprocesspsbt requires unlocked wallet when signing
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']