forked from bitcoindevkit/bdk
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge bitcoindevkit#1028: Add CreateTxError and use as error type for…
… TxBuilder::finish() 00ec19e ci: fix MSRV pinning for rustls 0.21.9 (Steve Myers) 77f9977 feat(wallet): Add infallible Wallet get_address(), get_internal_address functions (Steve Myers) 9e7d99e refactor(bdk)!: add context specific error types, remove top level error mod (Steve Myers) Pull request description: ### Description To remove some places where there were `.expect("TODO")` I added a new `CreateTxError` type which is returned from `TxBuilder::finish()`. I also updated related tests and doc tests. Fixes bitcoindevkit#996 (comment) Also added fallible `Wallet::try_get_address()` and `try_get_internal_address()` to return `Result` with a possible `D:WriteError` when a PersistBackend is used. This should fix bitcoindevkit#996. I removed catch-all bdk::Error and replaced usages with new types and updated related functions, fixes bitcoindevkit#994. ### Notes to the reviewers ~~I didn't add all possible bdk::Error types that `Wallet::create_tx()` and `TxBuilder::finish()` functions might throw. It's probably not too much more work but will take a bit more research so I want to make sure this is the right general approach first.~~ I added `anyhow` to the dev-dependencies so I could remove some `.expect()` lines from the docs tests and make the examples closer to what an end user should do. I also used the `anyhow!()` macro to replace a few places that were using the `bdk::Error::Generic` in example code. I also moved the module level error.rs file to wallet/error.rs so no one would be tempted to make any new catch all errors and to make it clear that all the errors in it are wallet module related. ### Changelog notice Changed - Updated bdk module to use new context specific error types - wallet: MiniscriptPsbtError, CreateTxError, BuildFeeBumpError error enums - coin_selection: module Error enum - Renamed fallible Wallet address functions to try_get_address() and try_get_internal_address() Removed - Removed catch-all top level bdk::Error enum - Removed impl_error macro Added - Added infallible Wallet get_address(), get_internal_address functions ### 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 #### Bugfixes: * [x] This pull request breaks the existing API * [ ] I've added tests to reproduce the issue which are now passing * [ ] I'm linking the issue being fixed by this PR Top commit has no ACKs. Tree-SHA512: a87c0856d71f9c945d12b6de6d368f49bd62d73886ac46ac83d00ddb81f2c38c5233ba053e40c76dea73ee7bfc19dac510eec5d7c9026ae50a2dc7308ac4786f
- Loading branch information
Showing
22 changed files
with
720 additions
and
369 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
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
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.