From: 志宇 Date: Sat, 6 Jan 2024 05:30:17 +0000 (+0800) Subject: Merge bitcoindevkit/bdk#1256: cherry-pick feat(wallet)!: add `NonEmptyDatabase` varia... X-Git-Tag: v1.0.0-alpha.3~3 X-Git-Url: http://internal-gitweb-vhost/script/%22https:/struct.CodeLengthError.html?a=commitdiff_plain;h=d71829914ae2a8be7448c2356e1906ced0e312aa;p=bdk Merge bitcoindevkit/bdk#1256: cherry-pick feat(wallet)!: add `NonEmptyDatabase` variant to `NewError` a1d34afa2455d93d23a36fd78d94aa79c7e493d1 feat(wallet)!: add `NonEmptyDatabase` variant to `NewError` (志宇) Pull request description: ### Description `NewError` is the error type when constructing a wallet with `Wallet::new`. We want this to return an error when the database already contains data (in which case, the caller should use `load` or `new_or_load`). ### Notes to the reviewers This is cherry-picked from #1172 so that we can add it to the alpha.3 release. ### Changelog notice Change - Return `NonEmptyDatabase` error when constructing a wallet with `Wallet::new` if the file already contains data (in which case, the caller should use `load` or `new_or_load`). ### 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 #### New Features: * [x] I've added tests for the new feature * [x] I've added docs for the new feature ACKs for top commit: evanlinjin: ACK a1d34afa2455d93d23a36fd78d94aa79c7e493d1 Tree-SHA512: 7c20171fa3d7dee5b1ac24f8a808781dbb0be0034951005e1e87acdf023123c01161e225b47b6d4484865889778c39549a3780f641227ddc0f84d1577d69f40a --- d71829914ae2a8be7448c2356e1906ced0e312aa