-
Notifications
You must be signed in to change notification settings - Fork 138
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
WIP: Descriptor updates #370
Merged
Merged
Conversation
This file contains 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
jgriffiths
force-pushed
the
descriptor_updates
branch
from
February 27, 2023 21:55
6a0d314
to
5b6bd56
Compare
jgriffiths
force-pushed
the
descriptor_updates
branch
from
March 15, 2023 23:01
5b6bd56
to
a96b682
Compare
I did some light testing in Sjors/libwally-swift#86 to see if the |
jgriffiths
force-pushed
the
descriptor_updates
branch
2 times, most recently
from
March 22, 2023 05:23
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.
jgriffiths
force-pushed
the
descriptor_updates
branch
from
March 29, 2023 22:54
5650ac2
to
27b3bd5
Compare
instagibbs
reviewed
Mar 30, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some light code review
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