-
Notifications
You must be signed in to change notification settings - Fork 168
Description
I am using rust-miniscript to work with taproot multi-signature scripts. I have a Descriptor<String> which defines the descriptor with a human readable placeholder keys and then I use a Translator with a map I maintain between these Strings and a concrete XOnlyPublicKey. When I apply the Translator I know have a Descriptor<XOnlyPublicKey>.
However, now if I want to use a PSBT to construct a transaction spending these inputs I need to the .update_with_descriptor_unchecked(...) interface which expects a descriptor of the form Descriptor<DefiniteDescriptorKey>.
My problem is how does rust-miniscript expect me to turn a Descriptor<XOnlyPublicKey> or Descriptor<PublicKey> into a Descriptor<DefiniteDescriptorKey>?
The only way I could figure out to do it was to serialize my Descriptor<XOnlyPublicKey> and use the FromStr interface to re-parse it as a Descriptor<DefiniteDescriptorKey>.
Similarly DescriptorPublicKey doesn't have a way to externally construct its Single variant other than with FromStr.
It feels like there needs to be an interface for constructing DefiniteDescriptorKey and DescriptorPublicKey directly from the rust-bitcoin key data structures rather than requiring a serialization-deserialization roundtrip.