push
github
Merge bitcoindevkit/bdk#1547: Simplify wallet persistence 340808e82 docs(wallet): fixes/improvements for `persisted` and `params` types (志宇) 960029324 feat(wallet)!: add persister (`P`) type param to `PersistedWallet<P>` (志宇) 06160574b revert(chain)!: rm `persit` module (志宇) a9c5f761c feat(wallet)!: remove dependency on `bdk_chain::Staged` (志宇) 06a9d6c72 feat(chain,wallet)!: publicize `.init_sqlite_tables` changeset methods (志宇) 039622fd1 feat(wallet)!: introduce `WalletPersister` (志宇) Pull request description: ### Description Removed the persistence module in `bdk_chain` (which contained the `PersistWith` and `PersistAsyncWith` traits and a `Persisted<T>` wrapper). Replaced it with simplified versions that are `Wallet`-specific. The new traits (`WalletPersister` and `AsyncWalletPersister`) are simpler since they have less type-parameters (being wallet-specific). The old versions were more complex as they were intended to be used with any type. However, we need more time to finalize a works-for-all-bdk-types persistence API. Additionally, `WalletPersister` and `AsyncWalletPersister` also introduce the `initialize` method. It is handy to contain db-initialization (i.e. create tables for SQL) here. We can call `initialize` in `PersistedWallet` constructors. So the `PersistedWallet::persist` method does not need to ensure the database is initialized. To accommodate this, I made the `.init_sqlite_table` methods on changeset-types public, and removed the call of this in `from_sqlite` and `.persist_to_sqlite`. The `initialize` method now loads from the persister, so the `load` associated function is removed. There was a bug in the old `PersistAsyncWith` trait where the lifetime bounds were not strict enough (refer to the conversation in #1552). This is now f... (continued)
83 of 155 new or added lines in 5 files covered. (53.55%)
5 existing lines in 1 file now uncovered.11121 of 13588 relevant lines covered (81.84%)
13793.67 hits per line