aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorIvan Metlushko <metlushko@gmail.com>2021-02-02 09:28:27 +0100
committerIvan Metlushko <metlushko@gmail.com>2021-03-09 09:04:35 +0100
commit2e5f7def22e1b212fbd69e9147145d9d1f408aaf (patch)
tree689614f9dd072e7b68a2739189db1c52bafef1af /test
parent461f0c781e5a9c13df21ca0c35029f685758d0bb (diff)
downloadbitcoin-2e5f7def22e1b212fbd69e9147145d9d1f408aaf.tar.xz
wallet, rpc: update listdescriptors response format
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/wallet_listdescriptors.py39
1 files changed, 25 insertions, 14 deletions
diff --git a/test/functional/wallet_listdescriptors.py b/test/functional/wallet_listdescriptors.py
index 8d02949ff4..c1444164ce 100755
--- a/test/functional/wallet_listdescriptors.py
+++ b/test/functional/wallet_listdescriptors.py
@@ -36,15 +36,16 @@ class ListDescriptorsTest(BitcoinTestFramework):
self.log.info('Test the command for empty descriptors wallet.')
node.createwallet(wallet_name='w2', blank=True, descriptors=True)
- assert_equal(0, len(node.get_wallet_rpc('w2').listdescriptors()))
+ assert_equal(0, len(node.get_wallet_rpc('w2').listdescriptors()['descriptors']))
self.log.info('Test the command for a default descriptors wallet.')
node.createwallet(wallet_name='w3', descriptors=True)
result = node.get_wallet_rpc('w3').listdescriptors()
- assert_equal(6, len(result))
- assert_equal(6, len([d for d in result if d['active']]))
- assert_equal(3, len([d for d in result if d['internal']]))
- for item in result:
+ assert_equal("w3", result['wallet_name'])
+ assert_equal(6, len(result['descriptors']))
+ assert_equal(6, len([d for d in result['descriptors'] if d['active']]))
+ assert_equal(3, len([d for d in result['descriptors'] if d['internal']]))
+ for item in result['descriptors']:
assert item['desc'] != ''
assert item['next'] == 0
assert item['range'] == [0, 0]
@@ -59,12 +60,17 @@ class ListDescriptorsTest(BitcoinTestFramework):
'desc': descsum_create('wpkh(' + xprv + hardened_path + '/0/*)'),
'timestamp': 1296688602,
}])
- expected = {'desc': descsum_create('wpkh([80002067' + hardened_path + ']' + xpub_acc + '/0/*)'),
- 'timestamp': 1296688602,
- 'active': False,
- 'range': [0, 0],
- 'next': 0}
- assert_equal([expected], wallet.listdescriptors())
+ expected = {
+ 'wallet_name': 'w2',
+ 'descriptors': [
+ {'desc': descsum_create('wpkh([80002067' + hardened_path + ']' + xpub_acc + '/0/*)'),
+ 'timestamp': 1296688602,
+ 'active': False,
+ 'range': [0, 0],
+ 'next': 0},
+ ],
+ }
+ assert_equal(expected, wallet.listdescriptors())
self.log.info('Test non-active non-range combo descriptor')
node.createwallet(wallet_name='w4', blank=True, descriptors=True)
@@ -73,9 +79,14 @@ class ListDescriptorsTest(BitcoinTestFramework):
'desc': descsum_create('combo(' + node.get_deterministic_priv_key().key + ')'),
'timestamp': 1296688602,
}])
- expected = [{'active': False,
- 'desc': 'combo(0227d85ba011276cf25b51df6a188b75e604b38770a462b2d0e9fb2fc839ef5d3f)#np574htj',
- 'timestamp': 1296688602}]
+ expected = {
+ 'wallet_name': 'w4',
+ 'descriptors': [
+ {'active': False,
+ 'desc': 'combo(0227d85ba011276cf25b51df6a188b75e604b38770a462b2d0e9fb2fc839ef5d3f)#np574htj',
+ 'timestamp': 1296688602},
+ ]
+ }
assert_equal(expected, wallet.listdescriptors())