-
Notifications
You must be signed in to change notification settings - Fork 13
CT descriptor: remove generic from blinding key #59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CT descriptor: remove generic from blinding key #59
Conversation
|
Yeah, this solution seems good to me. It's not great but nothing I could come up with was great either. I'd like to fix CI though before moving forward on this. |
f9d6655 to
51e7f22
Compare
|
Proposed additional test vectors for ELIP-150 View Descriptor with wildcard:
Non-View Descriptor with wildcard:
|
RCasatta
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| .ok() | ||
| .ok_or(ConversionError::HardenedChild)?, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
map_err ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did the same done in DescriptorPublicKey::at_derivation_index...
https://github.com/ElementsProject/elements-miniscript/blob/master/src/descriptor/key.rs#L632
The generic was only used by the `Bare` variant, which was inconsistent with its corresponding "secret" variant, `View`. The generic could be used to handle the conversion from `ConfidentialDescriptor<DescriptorPublicKey>` to `Descriptor<DefiniteDescriptorKey>`, specifically making sure that the descriptor blinding key does not have wildcards. For the `Bare` variant this could be done, but this cannot happen for the `View` variant, since we don't have the definite version of `DescriptorSecretKey`.
51e7f22 to
f4be6af
Compare
@apoelstra rebased and CI is now green |
apoelstra
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK f4be6af
|
Looks good to me. Obviously there are still some open API questions about doing derivations but the result of this is much better than the existing code. |
The generic was only used by the
Barevariant, which was inconsistent with its corresponding "secret" variant,View.The generic could be used to handle the conversion from
ConfidentialDescriptor<DescriptorPublicKey>toDescriptor<DefiniteDescriptorKey>, specifically making sure that the descriptor blinding key does not have wildcards.For the
Barevariant this could be done, but this cannot happen for theViewvariant, since we don't have the definite version ofDescriptorSecretKey.The proposed solution consists in:
ConfidentialDescriptor::at_derivation_indexthat "removes" wildcards from both the "bitcoin" descriptor and the descriptor blinding key. This makes deriving an address from a CT descriptor with wildcards less cumbersome.Key::to_public_key(&self, secp, spk)to return aResultand error ifKeyhas some wildcards. This will fix the casect(xprv/*,desc)which is currently broken.