refactor(wallet)!: Replace new_or_load() with load_with_descriptors()#1512
Closed
notmandatory wants to merge 1 commit intobitcoindevkit:masterfrom
Closed
refactor(wallet)!: Replace new_or_load() with load_with_descriptors()#1512notmandatory wants to merge 1 commit intobitcoindevkit:masterfrom
new_or_load() with load_with_descriptors()#1512notmandatory wants to merge 1 commit intobitcoindevkit:masterfrom
Conversation
c639329 to
91fd8d8
Compare
91fd8d8 to
fa2f2ab
Compare
storopoli
reviewed
Jul 12, 2024
storopoli
left a comment
There was a problem hiding this comment.
Some brief notes that I saw while skimming over.
Updated load_with_descriptors() requires a ChangeSet and descriptors, validates they match. If the given descriptors have private keys signers are added. Also rename load_from_changeset() to load() and remove no longer needed NewOrLoadError.
fa2f2ab to
b978e16
Compare
8 tasks
| let mut wallet = if let Some(changeset) = changeset { | ||
| Wallet::load_with_descriptors(external_descriptor, internal_descriptor, changeset)? | ||
| } else { | ||
| Wallet::new(external_descriptor, internal_descriptor, Network::Testnet)? |
Collaborator
There was a problem hiding this comment.
For consistency should we have Signet here?
Suggested change
| Wallet::new(external_descriptor, internal_descriptor, Network::Testnet)? | |
| Wallet::new(external_descriptor, internal_descriptor, Network::Signet)? |
| let mut wallet = if let Some(changeset) = changeset { | ||
| Wallet::load_with_descriptors(&args.descriptor, &args.change_descriptor, changeset)? | ||
| } else { | ||
| Wallet::new(&args.descriptor, &args.change_descriptor, Network::Testnet)? |
Collaborator
There was a problem hiding this comment.
Suggested change
| Wallet::new(&args.descriptor, &args.change_descriptor, Network::Testnet)? | |
| Wallet::new(&args.descriptor, &args.change_descriptor, args.network)? |
Collaborator
oleonardolima
left a comment
There was a problem hiding this comment.
It's looking good, the API got much more intelligible to me.
Concept ACK
Member
Author
|
closing in favor of #1514 |
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.
Description
Replace
Wallet::new_or_load()withWallet::load_with_descriptors(). UpdatedWallet::load_with_descriptors()now requires aChangeSetand descriptors, and validates they match, if the given descriptors have private keys it adds signers.Also rename
Wallet::load_from_changeset()toWallet::load()and remove no longer neededNewOrLoadError.Notes to the reviewers
Based on discussion in #1500.
Changelog notice
Changed
Checklists
All Submissions:
cargo fmtandcargo clippybefore committingNew Features: