mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-03 20:21:34 +02:00
wallet, rpc: add listdescriptors private option
This commit is contained in:
@ -71,11 +71,39 @@ class ListDescriptorsTest(BitcoinTestFramework):
|
||||
],
|
||||
}
|
||||
assert_equal(expected, wallet.listdescriptors())
|
||||
assert_equal(expected, wallet.listdescriptors(False))
|
||||
|
||||
self.log.info('Test list private descriptors')
|
||||
expected_private = {
|
||||
'wallet_name': 'w2',
|
||||
'descriptors': [
|
||||
{'desc': descsum_create('wpkh(' + xprv + hardened_path + '/0/*)'),
|
||||
'timestamp': 1296688602,
|
||||
'active': False,
|
||||
'range': [0, 0],
|
||||
'next': 0},
|
||||
],
|
||||
}
|
||||
assert_equal(expected_private, wallet.listdescriptors(True))
|
||||
|
||||
self.log.info("Test listdescriptors with encrypted wallet")
|
||||
wallet.encryptwallet("pass")
|
||||
assert_equal(expected, wallet.listdescriptors())
|
||||
|
||||
self.log.info('Test list private descriptors with encrypted wallet')
|
||||
assert_raises_rpc_error(-13, 'Please enter the wallet passphrase with walletpassphrase first.', wallet.listdescriptors, True)
|
||||
wallet.walletpassphrase(passphrase="pass", timeout=1000000)
|
||||
assert_equal(expected_private, wallet.listdescriptors(True))
|
||||
|
||||
self.log.info('Test list private descriptors with watch-only wallet')
|
||||
node.createwallet(wallet_name='watch-only', descriptors=True, disable_private_keys=True)
|
||||
watch_only_wallet = node.get_wallet_rpc('watch-only')
|
||||
watch_only_wallet.importdescriptors([{
|
||||
'desc': descsum_create('wpkh(' + xpub_acc + ')'),
|
||||
'timestamp': 1296688602,
|
||||
}])
|
||||
assert_raises_rpc_error(-4, 'Can\'t get descriptor string', watch_only_wallet.listdescriptors, True)
|
||||
|
||||
self.log.info('Test non-active non-range combo descriptor')
|
||||
node.createwallet(wallet_name='w4', blank=True, descriptors=True)
|
||||
wallet = node.get_wallet_rpc('w4')
|
||||
|
Reference in New Issue
Block a user