Skip to content

Add translate_pk method for ConfidentialDescriptor#99

Merged
apoelstra merged 1 commit into
ElementsProject:masterfrom
Velnbur:master
Jun 22, 2026
Merged

Add translate_pk method for ConfidentialDescriptor#99
apoelstra merged 1 commit into
ElementsProject:masterfrom
Velnbur:master

Conversation

@Velnbur

@Velnbur Velnbur commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

The reasoning behind this PR is a small enhancement in developer experience. miniscript::Descriptor has translate_pk method, but ConfidentialDescriptor does not. Because of this, to translate the inner descriptor, the user needs to extract it and then move the key:

let conf_descriptor = ConfidentialDescriptor::<DescriptorPublicKey>::from_str(&descriptor_str).unwrap();

let definite_desc = conf_descriptor
    .descriptor
    .translate_pk(&mut translator)
    .unwrap();

let definite_conf_descriptor = ConfidentialDescriptor {
    descriptor: definite_desc,
    key: conf_descriptor.key,
};

definite_conf_descriptor.address(SECP256K1, &AddressParams::LIQUID)

When in miniscript, this can be done with method chain calls:

let descriptor = Descriptor::<DescriptorPublicKey>::from_str(&wallet.descriptor).unwrap();

descriptor
    .translate_pk(&mut translator)
    .unwrap()
    .address(Network::Bitcoin)

@apoelstra apoelstra left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK d12cf6c; successfully ran local tests; yeah, this seems useful, though I wish we had a more elegant way to treat blinding keys like descriptor keys

@apoelstra

Copy link
Copy Markdown
Member

FYI I disabled the integration tests locally. I will PR to fix up CI and see if we can get a fix on the problem, but let's get this and #100 in first.

@apoelstra apoelstra merged commit 0a2d69d into ElementsProject:master Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants