aboutsummaryrefslogtreecommitdiff
path: root/test/functional/wallet_importmulti.py
diff options
context:
space:
mode:
authorAurèle Oulès <aurele@oules.com>2022-09-17 22:22:24 +0200
committerAurèle Oulès <aurele@oules.com>2022-09-19 13:54:55 +0200
commit2c03465dfa18ee615f76b6e507a65ef451ce1b7c (patch)
tree5a2d573bbc4df8e886a191c9332aa51b741d0829 /test/functional/wallet_importmulti.py
parent1fcf9e6e81ea8299fad958b32777c36b696090ac (diff)
downloadbitcoin-2c03465dfa18ee615f76b6e507a65ef451ce1b7c.tar.xz
test: Test watchonly imports with passphrase-locked wallet
Diffstat (limited to 'test/functional/wallet_importmulti.py')
-rwxr-xr-xtest/functional/wallet_importmulti.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/functional/wallet_importmulti.py b/test/functional/wallet_importmulti.py
index 3953851491..62a1a3341d 100755
--- a/test/functional/wallet_importmulti.py
+++ b/test/functional/wallet_importmulti.py
@@ -874,6 +874,25 @@ class ImportMultiTest(BitcoinTestFramework):
addr = wrpc.getnewaddress('', 'bech32')
assert_equal(addr, addresses[i])
+ # Create wallet with passphrase
+ self.log.info('Test watchonly imports on a wallet with a passphrase, without unlocking')
+ self.nodes[1].createwallet(wallet_name='w1', blank=True, passphrase='pass')
+ wrpc = self.nodes[1].get_wallet_rpc('w1')
+ assert_raises_rpc_error(-13, "Please enter the wallet passphrase with walletpassphrase first.",
+ wrpc.importmulti, [{
+ 'desc': descsum_create('wpkh(' + pub1 + ')'),
+ "timestamp": "now",
+ }])
+
+ result = wrpc.importmulti(
+ [{
+ 'desc': descsum_create('wpkh(' + pub1 + ')'),
+ "timestamp": "now",
+ "watchonly": True,
+ }]
+ )
+ assert result[0]['success']
+
if __name__ == '__main__':
ImportMultiTest().main()