Skip to content

Only public API for constructing DefiniteDescriptorKey or DefinitePublicKey is from_str(...)? #817

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

Closed
philipr-za opened this issue May 12, 2025 · 0 comments · Fixed by #818

Comments

@philipr-za
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant