Merged
Conversation
6a0d314 to
5b6bd56
Compare
5b6bd56 to
a96b682
Compare
Contributor
|
I did some light testing in Sjors/libwally-swift#86 to see if the |
5314425 to
5650ac2
Compare
Expose BIP32_FLAG_STR_MULTIPATH for the API, but do not implement its logic yet, except to disallow it for bip32_key_from_parent_path_str (since this function does not have a multi_index argument to use it).
Also fix the range indicator not being valid after a multi-path, and detecting a missing initial multi-path child.
This allows invalid paths to be detected while parsing instead of during script or address generation, and lets callers introspect and iterate each path in turn.
Store whether each keys path is ranged or a multi-path in its parsed node. Use this info to only pass the child number/multi-path index when deriving keys that use these features. This allows mixing ranged/non-ranged plus multi-path/non-multi-path keys (subject to the other validity checks, such as ensuring any multi-paths all have the same number of elements).
Following this change, the canonical way to get all addresses for a
descriptor is:
for (size_t variant = 0; variant < num_variants; ++variant) {
for (size_t multi_index = 0; multi_index < num_multipaths; ++multi_index) {
/* Generate for a fixed child number or loop over desired children */
}
}
Where num_variants and num_multipaths are returned from
wally_descriptor_get_features() - which also returns whether the
descriptor is ranged and thus child_num can take any valid BIP32 value.
5650ac2 to
27b3bd5
Compare
instagibbs
reviewed
Mar 30, 2023
Contributor
instagibbs
left a comment
There was a problem hiding this comment.
some light code review
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.
Adds more introspection information and support for multi-path descriptors.
This allows iteration/generation of all available possible scripts/addresses without knowing anything about a descriptor up-front.
cc: @Sjors @k-matsuzawa