forked from bitcoindevkit/bdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(chain,wallet)!: Change persist-traits to be "safer"
Previously, `Persist{Async}With::persist` can be directly called as a method on the type (i.e. `Wallet`). However, the `db: Db` (which is an input) may not be initialized. We want a design which makes it harder for the caller to make this mistake. We change `Persist{Async}With::persist` to be an "associated function" which takes two inputs: `db: &mut Db` and `changeset`. However, the implementer cannot take directly from `Self` (as it's no longer an input). So we introduce a new trait `Staged` which defines the staged changeset type and a method that gives us a `&mut` of the staged changes.
- Loading branch information
1 parent
3aed4cf
commit 892b97d
Showing
3 changed files
with
66 additions
and
33 deletions.
There are no files selected for viewing
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
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
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