diff options
author | Andrew Chow <github@achow101.com> | 2022-09-20 11:54:17 -0400 |
---|---|---|
committer | Andrew Chow <github@achow101.com> | 2022-09-20 12:00:02 -0400 |
commit | fc4017552c980ec9e95de677ea8166702351b79d (patch) | |
tree | f0d6b39ff3312ebb45ba42cc2928bf47578bd2f0 /test/functional | |
parent | 5b6f0f31fa6ce85db3fb7f9823b1bbb06161ae32 (diff) | |
parent | 2c03465dfa18ee615f76b6e507a65ef451ce1b7c (diff) |
Merge bitcoin/bitcoin#26116: rpc: Allow importmulti watchonly imports with locked wallet
2c03465dfa18ee615f76b6e507a65ef451ce1b7c test: Test watchonly imports with passphrase-locked wallet (Aurèle Oulès)
1fcf9e6e81ea8299fad958b32777c36b696090ac rpc: Allow importmulti watchonly imports with locked wallet (Aurèle Oulès)
Pull request description:
Allows watch-only imports on locked wallets with `importmulti`.
Also adds a test.
Fixes #17867.
ACKs for top commit:
achow101:
ACK 2c03465dfa18ee615f76b6e507a65ef451ce1b7c
kristapsk:
re-ACK 2c03465dfa18ee615f76b6e507a65ef451ce1b7c
theStack:
re-ACK 2c03465dfa18ee615f76b6e507a65ef451ce1b7c
Tree-SHA512: 9978d6e59a230c0d160efd312c671cf59458797387d6622b6bf5c9e0681c1fcfebedb3d834fa9314dc5a1eda97e3295696352eacbeab9b43a46b942990087035
Diffstat (limited to 'test/functional')
-rwxr-xr-x | test/functional/wallet_importmulti.py | 19 |
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() |