0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-08 10:31:50 -05:00

test: Test watchonly imports with passphrase-locked wallet

This commit is contained in:
Aurèle Oulès 2022-09-17 22:22:24 +02:00
parent 1fcf9e6e81
commit 2c03465dfa
No known key found for this signature in database
GPG key ID: 55F3976F7001D998

View file

@ -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()