Skip to content

Commit 2c03465

Browse files
committed
test: Test watchonly imports with passphrase-locked wallet
1 parent 1fcf9e6 commit 2c03465

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/functional/wallet_importmulti.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -874,6 +874,25 @@ def run_test(self):
874874
addr = wrpc.getnewaddress('', 'bech32')
875875
assert_equal(addr, addresses[i])
876876

877+
# Create wallet with passphrase
878+
self.log.info('Test watchonly imports on a wallet with a passphrase, without unlocking')
879+
self.nodes[1].createwallet(wallet_name='w1', blank=True, passphrase='pass')
880+
wrpc = self.nodes[1].get_wallet_rpc('w1')
881+
assert_raises_rpc_error(-13, "Please enter the wallet passphrase with walletpassphrase first.",
882+
wrpc.importmulti, [{
883+
'desc': descsum_create('wpkh(' + pub1 + ')'),
884+
"timestamp": "now",
885+
}])
886+
887+
result = wrpc.importmulti(
888+
[{
889+
'desc': descsum_create('wpkh(' + pub1 + ')'),
890+
"timestamp": "now",
891+
"watchonly": True,
892+
}]
893+
)
894+
assert result[0]['success']
895+
877896

878897
if __name__ == '__main__':
879898
ImportMultiTest().main()

0 commit comments

Comments
 (0)