-
Notifications
You must be signed in to change notification settings - Fork 390
Various improvements not included in #1203 #1438
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
Conversation
Also rename `descriptor_ids_to_keychain_set` to `descriptor_ids_to_keychains` and update it's documentation.
Change the out signature of methods `reveal_to_target`, `reveal_next_spk` and `next_unused_spk` to return a tuple of `(Option<spk(s)>, changeset)` instead of `Option<(spk(s), changeset)>`. This makes the API more consistent. Also refactored various helper methods to take in a descriptor instead of a descriptor id. `.expect` calls now exist outside of these helper methods, making it more obvious where they are being called. Docs are updated to reflect the new API.
86f3028
to
78e3264
Compare
In terms of super simple names you could have |
I got tripped up at this comment. I think what's happening is we're removing this keychain from the old descriptor's set bdk/crates/chain/src/keychain/txout_index.rs Lines 509 to 516 in 78e3264
|
Maybe more of a philosophical point, but I think an argument can be made that methods which previously returned |
Can you also add changes from #1341? |
Good idea |
Is it worth revisiting a discussion of returning |
Reviewed up through 78e3264. For a minute I thought all of #1341 was done but it looks like there's a few more places like documentation nit: There's a missing backtick in the docs for keychain |
@LagginTimes can you complete this PR for me?
|
Replaced by #1451 |
Description
Adds various improvements to the work of #1203. These were missed out while cherry-picking, or review comments left in #1428 that were forgotten:
keychains_to_descriptors
tokeychains_to_descriptor_ids
which simplifies the field. This was mentioned here and included in Further work on #1203 #1428, but an older commit was cherry-picked.KeychainTxOutIndex
fielddescriptor_ids_to_keychain_set
todescriptor_ids_to_keychains
was missed out as an older commit was cherry-picked. This change to naming shows the direct relationship betweenkeychains_to_desriptor_ids
anddescriptor_ids_to_keychains
(one is directly a reverse lookup of the other).reveal_to_target_with_id
toreveal_to_target_with_descriptor
, reasoning mentioned here.In addition to this, I changed the output signature of
reveal_to_target
,reveal_next_spk
andnext_unused_spk
methods to return(Option<spk(s)>, changeset)
, whereas previously it wasOption<(spk(s), changeset)>
. This makes the API more consistent as theChangeSet
is always returned, andreveal_to_target
andunbounded_spk_iter
-esc methods all returnOption<SpkIterator>
(which we can.flatten()
).Notes to the reviewers
Not all changes in this PR are Changelog-worthy. I.e. renaming of internal variables to increase readability, changing code comments, refactoring private methods - are all excluded from the changelog.
Changelog notice
KeychainTxOutIndex
methods to always return a changeset. This makes the API more consistent.Checklists
All Submissions:
cargo fmt
andcargo clippy
before committing