Skip to content

Allow constructing Sh descriptors wrapping an existing Wsh/Wpkh #299

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

Merged
merged 1 commit into from
Mar 9, 2022

Conversation

shesek
Copy link
Contributor

@shesek shesek commented Feb 24, 2022

Useful if you already have an W{s,pk}h descriptor and wish to wrap it with P2SH.

This used to be possible before the new inner types for the Descriptor enum variants, which has private fields that cannot be initialized externally.

shesek added a commit to shesek/minsc that referenced this pull request Feb 24, 2022
Copy link
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

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

ACK bd7c642

Looks good! I'll let @sanket1729 also check this out, in case he has opinions about the method naming.

Copy link
Member

@sanket1729 sanket1729 left a comment

Choose a reason for hiding this comment

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

ACK bd7c642

@sanket1729
Copy link
Member

Actually, re-reading it. I have some complaints about the names :(.
This is not consistent with the other names in the API. We have names like Descriptor::new_wsh() instead of Descriptor::new_with_wsh. I would prefer to change to new_<name> from new_with_<name> without the with for consistency with other APIs.

We want to be more rust-idiomatic with names like Descriptor::with_wsh (instead of new_with_wsh (as suggested in this PR), or new_wsh as implemented in master). But that is another issue.

shesek added a commit to shesek/minsc that referenced this pull request Feb 26, 2022
@shesek
Copy link
Contributor Author

shesek commented Feb 26, 2022

@sanket1729 Descriptor::new_sh_wsh(), Descriptor::new_sh_wpkh(), Sh::new_wsh() and Sh::new_wpkh() already exists though, with a different meaning (they accept the underlying Miniscript and wrap it with a W{s,pk}h descriptor, rather than accept the descriptor directly).

shesek added a commit to shesek/minsc that referenced this pull request Mar 2, 2022
@sanket1729 sanket1729 merged commit 239e61e into rust-bitcoin:master Mar 9, 2022
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.

3 participants