Backports BIP-388 WalletPolicy support to release-13.x - #1009
Open
trevarj wants to merge 7 commits into
Open
Conversation
- Instead of accepting a closure to convert the Key type to a String, added type bounds to use Key: FromStr. - Added new error type XKeyParseError, which will be a wrapper for the error type on a Key's FromStr. XKeyParseError must implement From from that type. - Change visibility of parse_xkey_deriv to pub(crate) for later usage.
- two new derivation_path functions, `derivation_path` and `derivation_paths` that omit the path origin - a `wildcard` accessor function to get the Wildcard value
Implemented BIP-388 by introducing a new type, `WalletPolicy`, which can be used to create descriptor templates. The idea is pretty simple and only really required making a new type that implements `MiniscriptKey`, then the existing parser and `Translator` trait takes care of the rest. There are a few edge cases that require validation, which isn't so nice, but works for now. Test cases that require BIP-390 and BIP-387's sortedmulti_a are commented out and issues could arise with those test vectors when/if those BIPs are implemented. See `WalletPolicy`'s doc and the unit tests for usage.
…ceholders set_key_info() counted key-expression occurrences instead of unique placeholder indices. A template reusing @0 with disjoint paths (e.g. @0/**,@0/<2;3>/*) would accept 2 keys but silently drop the second during descriptor translation, since both @0 resolve to key_info[0]. Reported by jm@squareup.com
Reported by jm@squareup.com
- translate all four hash terminal types between key representations - report invalid hash hex and cover descriptor round trips
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backports PRs by cherry-picking all commits:
For supporting external issue bhwi #68 to move from git commit pinning to a released crate.