Skip to content

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

Closed
@philipr-za

Description

@philipr-za

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions