Motivation:
- ranged descriptors MUST not be able to have label (current impl allows it)
- external non-ranged descriptor MUST be able to have label (current impl disallows it)
Repro steps:
- create blank wallet and import descriptors
- external has
label=test
(not internal)
0 conn = bitcoind.create_wallet(wallet_name=w_name, disable_private_keys=True, blank=True,
1 passphrase=None, avoid_reuse=False, descriptors=True)
2 descriptors = [
3 {
4 "timestamp": "now",
5 "label": "test",
6 "active": True,
7 "desc": "wpkh([0f056943/84h/1h/0h]tpubDC7jGaaSE66Pn4dgtbAAstde4bCyhSUs4r3P8WhMVvPByvcRrzrwqSvpF9Ghx83Z1LfVugGRrSBko5UEKELCz9HoMv5qKmGq3fqnnbS5E9r/0/*)#erexmnep",
8 "internal": False
9 },
10 {
11 "desc": "wpkh([0f056943/84h/1h/0h]tpubDC7jGaaSE66Pn4dgtbAAstde4bCyhSUs4r3P8WhMVvPByvcRrzrwqSvpF9Ghx83Z1LfVugGRrSBko5UEKELCz9HoMv5qKmGq3fqnnbS5E9r/1/*)#ghu8xxfe",
12 "active": True,
13 "internal": True,
14 "timestamp": "now"
15 },
16 ]
17 r = conn.importdescriptors(descriptors)
18 print(r)
response:
0[{'error': {'code': -8,
1 'message': 'Internal addresses should not have a label'},
2 'success': False,
3 'warnings': ['Range not given, using default keypool range']},
4 {'success': True,
5 'warnings': ['Range not given, using default keypool range']}]
But in above, ONLY external has a label.
If you remove label
from external descriptor import object - it will import no problem:
0[{'success': True,
1 'warnings': ['Range not given, using default keypool range']},
2 {'success': True,
3 'warnings': ['Range not given, using default keypool range']}]
Even tho it should NOT, as the descriptor is ranged. Current implementation relies on checking user provided data to decide whether desc is ranged.