-
Notifications
You must be signed in to change notification settings - Fork 311
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
Refactor wallet and persist mod, remove bdk_persist crate #1454
Refactor wallet and persist mod, remove bdk_persist crate #1454
Conversation
e5a10f7
to
e5c73ec
Compare
2fc8540
to
6b047ea
Compare
6b047ea
to
39d4c86
Compare
96c758c
to
4ab0648
Compare
@matthiasdebernardini I added an async version of the persist trait called |
This is looking good. Removing the persistence backend from wallet is a welcome change. The main concern with doing so is newly revealed addresses not being persisted, but this is addressed with good documentation. |
Maybe worth keeping the |
c2ac570
to
c23d2bc
Compare
395ffa3
to
4b5166b
Compare
c1b3e0c
to
ded0bfe
Compare
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.
ACK c9d1b41
c9d1b41
to
dbbc8ce
Compare
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.
ACK 6323d55
I rebased to add one more small fix to the bdk_wallet README.md.
dbbc8ce
to
6323d55
Compare
Also add refactored StagedPersist to chain crate with tests.
…::persist Also update examples and remove bdk_persist crate.
Still enable the `persist` submodule without `miniscript` feature flag. Only disable `CombinedChangeSet`. Also stop `cargo clippy` from complaining about unused imports when `miniscript` is disabled.
A staging area is helpful because we can contain logic to ignore empty changesets and not clear staging area if the persistence backend fails.
6323d55
to
ec36c7e
Compare
Had to do one final force push after rebasing on master. |
ACK ec36c7e |
Description
Sorry to submit another refactor PR for the persist related stuff, but I think it's worth revisiting. My primary motivations are:
db
fromWallet
so users have the ability to useasync
storage crates, for example usingsqlx
. I updated docs and examples to let users know they are responsible for persisting changes.anyhow
dependency everywhere (except as a dev test dependency). It really doesn't belong in a lib and by removing persistence fromWallet
it isn't needed.bdk_persist
crate and revert back to the original design with generic error types. I kept theDebug
andDisplay
constrains on persist errors so they could still be used with theanyhow!
macro.Notes to the reviewers
I also replaced/renamed old
Persist
withStagedPersist
struct inspired by #1453, it is only used in examples. TheWallet
handles it's own staging.Changelog notice
Changed
db
fromWallet
, users are now responsible for persisting changes, see docs and examples.bdk_persist
crate and moved logic back tobdk_chain::persist
module.PersistBackendAsync
,StagedExt
, andStageExtAsync
traits.Wallet
functionscommit_to
andcommit_to_async
.Checklists
All Submissions:
cargo fmt
andcargo clippy
before committing