Descriptor support for displayaddress#117
Conversation
c161d8f to
d29f0ae
Compare
d29f0ae to
3b6e3bd
Compare
3b6e3bd to
e22dc4c
Compare
|
Needs rebase |
e22dc4c to
dfaf436
Compare
|
Rebased |
achow101
left a comment
There was a problem hiding this comment.
What happens if you do --sh_wpkh --desc wpkh(...)?
| process_commands(self.dev_args + ['displayaddress', '--path', 'm/44h/1h/0h/0/0']) | ||
| process_commands(self.dev_args + ['displayaddress', '--sh_wpkh', '--path', 'm/49h/1h/0h/0/0']) | ||
| process_commands(self.dev_args + ['displayaddress', '--wpkh', '--path', 'm/84h/1h/0h/0/0']) | ||
| process_commands(self.dev_args + ['displayaddress', '--desc', 'wpkh(m/84h/1h/0h/0/0)']) |
There was a problem hiding this comment.
I don't think that's a valid descriptor.
| if origin_match == None: | ||
| return None | ||
|
|
||
| return cls(origin_fingerprint, origin_path, base_key, path_suffix, testnet, sh_wpkh, wpkh) |
There was a problem hiding this comment.
I got an error which points here: UnboundLocalError: local variable 'path_suffix' referenced before assignment
path_suffix won't be set if the else branch above is taken.
80423aa to
36ac3e0
Compare
|
Rebased. I added a check to prevent |
| xpub = client.get_pubkey_at_path(descriptor.m_path_base)['xpub'] | ||
| if descriptor.base_key != xpub and descriptor.base_key != xpub_to_pub_hex(xpub): | ||
| return {'error':'Key in descriptor does not match device: ' + desc,'code':BAD_ARGUMENT} | ||
| client.display_address(descriptor.m_path, descriptor.sh_wpkh, descriptor.wpkh) |
There was a problem hiding this comment.
This needs to be a return statement.
There was a problem hiding this comment.
I think we need to add a linter to Travis :-) Though I guess it's hard to tell because Python doesn't enforce return values.
36ac3e0 to
0c1f9f6
Compare
achow101
left a comment
There was a problem hiding this comment.
Testing everything else, I think that's the last thing before I merge this
| if path is not None: | ||
| if sh_wpkh == True and wpkh == True: | ||
| return {'error':'Both `--wpkh` and `--sh_wpkh` can not be selected at the same time.','code':BAD_ARGUMENT} | ||
| client.display_address(path, sh_wpkh, wpkh) |
0c1f9f6 to
a71658c
Compare
|
ACK a71658c |
a71658c displayaddress: descriptor support, make --path a named argument (Sjors Provoost) 163f926 Add descriptor class (Sjors Provoost) 6fc1524 HardwareWalletClient: store fingerprint (Sjors Provoost) Pull request description: Adds a `Descriptor` class, which currently handles some of the descriptor functionality. Changes `displayaddress` to allow a descriptor argument. This means `--path` and `--desc` are now named arguments. When using a descriptor `displayaddress` performs additional checks to make sure the fingerprint and xpub match. To enable the fingerprint check, I'm storing the fingerprint on `HardwareWalletClient` instances. Tree-SHA512: f149481203c340b8e5347f42fd2924f1b2095197d6c25f39f94acfb11f430881412cce48c510260db4e773b662e8b2a0a747c413ba7fadfc6eb78a85f1ec4838
Adds a
Descriptorclass, which currently handles some of the descriptor functionality.Changes
displayaddressto allow a descriptor argument. This means--pathand--descare now named arguments.When using a descriptor
displayaddressperforms additional checks to make sure the fingerprint and xpub match. To enable the fingerprint check, I'm storing the fingerprint onHardwareWalletClientinstances.