From: Steve Myers Date: Thu, 13 Jun 2024 22:46:11 +0000 (-0500) Subject: Merge bitcoindevkit/bdk#1454: Refactor wallet and persist mod, remove bdk_persist... X-Git-Tag: v1.0.0-alpha.13~3 X-Git-Url: http://internal-gitweb-vhost/script/%22https:/database/scripts/static/struct.DistMap.html?a=commitdiff_plain;h=782eb56bd4c936d889565358caf0d9079e3ae82f;p=bdk Merge bitcoindevkit/bdk#1454: Refactor wallet and persist mod, remove bdk_persist crate ec36c7eccacc8347568b77ed1dfc0c50a2524906 feat(example): use changeset staging with rpc polling example (志宇) 19328d4999c19557778b7b108f88f42b1258957e feat(wallet)!: change persist API to use `StageExt` and `StageExtAsync` (志宇) 2e40b0118cc88539f38420e347eb4d562b1be0b1 feat(chain): reintroduce a way to stage changesets before persisting (志宇) 36e82ec6869c5c5c5669d4d049636225f9a8e986 chore(chain): relax `miniscript` feature flag scope (志宇) 9e97ac03307f3194e043ef430e4bde2e5c25254c refactor(persist): update file_store, sqlite, wallet to use bdk_chain::persist (Steve Myers) 54b0c11cbe1d08eb955e50f0ac719a0b19e3032a feat(persist): add PersistAsync trait and StagedPersistAsync struct (Steve Myers) aa640ab2770bea19259eedea6882b202a5845f35 refactor(persist): rename PersistBackend to Persist, move to chain crate (Steve Myers) Pull request description: ### Description Sorry to submit another refactor PR for the persist related stuff, but I think it's worth revisiting. My primary motivations are: 1. remove `db` from `Wallet` so users have the ability to use `async` storage crates, for example using `sqlx`. I updated docs and examples to let users know they are responsible for persisting changes. 2. remove the `anyhow` dependency everywhere (except as a dev test dependency). It really doesn't belong in a lib and by removing persistence from `Wallet` it isn't needed. 3. remove the `bdk_persist` crate and revert back to the original design with generic error types. I kept the `Debug` and `Display` constrains on persist errors so they could still be used with the `anyhow!` macro. ### Notes to the reviewers I also replaced/renamed old `Persist` with `StagedPersist` struct inspired by #1453, it is only used in examples. The `Wallet` handles it's own staging. ### Changelog notice Changed - Removed `db` from `Wallet`, users are now responsible for persisting changes, see docs and examples. - Removed the `bdk_persist` crate and moved logic back to `bdk_chain::persist` module. - Renamed `PersistBackend` trait to `Persist` - Replaced `Persist` struct with `StagedPersist` ### Checklists #### All Submissions: * [x] I've signed all my commits * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md) * [x] I ran `cargo fmt` and `cargo clippy` before committing ACKs for top commit: ValuedMammal: ACK ec36c7eccacc8347568b77ed1dfc0c50a2524906 Tree-SHA512: 380b94ae42411ea174720b7c185493c640425f551742f25576a6259a51c1037b441a238c6043f4fdfbf1490aa15f948a34139f1850d0c18d285110f6a9f36018 --- 782eb56bd4c936d889565358caf0d9079e3ae82f