Return error from at_derivation_index when descriptor has no wildcard#911
Return error from at_derivation_index when descriptor has no wildcard#911febyeji wants to merge 3 commits intorust-bitcoin:masterfrom
Conversation
trevarj
left a comment
There was a problem hiding this comment.
But what should the workflow be if you just want to convert a DescriptorPublicKey descriptor to a DefiniteDescriptorKey one, not touching wildcards if they don't exist?
I'm ok with this as long as we address what Andrew said in the linked issue. I also would like a way to convert from Descriptor<DescriptorPublicKey> into Descriptor<DefiniteDescriptorKey> since I am currently using at_derivation_index as an agnostic translation.
Maybe it can be solved with just adding a helper function into_definite() or something.
|
Thanks for the review! Extracted a public |
Address review feedback: unify the duplicated `Definitor` and
`Derivator` translator structs into a single `enum Definitor { FromPk, AtIndex(u32) }`
shared by both `into_definite()` and `at_derivation_index()`.
Closes #829.
at_derivation_index()on a descriptor without wildcards would silently ignore the index and return the descriptor unchanged. This was error-prone because callers would expect different indices to produce different addresses.DefiniteDescriptorKey::new()on individual keys, or checkhas_wildcard()before callingat_derivation_index().at_derivation_indexwildcard check