From: 志宇 Date: Thu, 6 Jun 2024 04:17:19 +0000 (+0800) Subject: Merge bitcoindevkit/bdk#1441: Remove duplicated InsufficientFunds error member X-Git-Tag: v1.0.0-alpha.13~7 X-Git-Url: http://internal-gitweb-vhost/script/%22https:/struct.CommandStringError.html?a=commitdiff_plain;h=b4a847f801ee824336026fed29ec620be3d30f51;p=bdk Merge bitcoindevkit/bdk#1441: Remove duplicated InsufficientFunds error member 29c8a00b435bdf2fa1d7c707ad09c1a47edc07b3 chore(wallet): remove duplicated InsufficientFunds error member from CreateTxError (e1a0a0ea) Pull request description: closes #1440 ### Description - Replace `CreateTxError::InsufficientFunds` use by `coin_selection::Error::InsufficientFunds` - Remove `InsufficientFunds` member from `CreateTxError` enum - Rename `coin_selection::Error` to `coin_selection::CoinSelectionError` ### Notes to the reviewers - We could also keep both members but rename one of them to avoid confusion ### 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: evanlinjin: ACK 29c8a00b435bdf2fa1d7c707ad09c1a47edc07b3 notmandatory: ACK 29c8a00b435bdf2fa1d7c707ad09c1a47edc07b3 Tree-SHA512: a1132d09929f99f0a5e82d3ccfaa85695ae50d7d4d5d9e8fd9ef847313918ed8c7a01005f45483fef6aeae36730a0da2fed9a9f10c3ce2f0a679527caf798bfe --- b4a847f801ee824336026fed29ec620be3d30f51 diff --cc crates/wallet/src/wallet/error.rs index 3504b7d2,6935deab..7b19a2ec --- a/crates/wallet/src/wallet/error.rs +++ b/crates/wallet/src/wallet/error.rs @@@ -90,15 -90,10 +90,8 @@@ pub enum CreateTxError NoUtxosSelected, /// Output created is under the dust limit, 546 satoshis OutputBelowDustLimit(usize), - /// The `change_policy` was set but the wallet does not have a change_descriptor - ChangePolicyDescriptor, /// There was an error with coin selection CoinSelection(coin_selection::Error), - /// Wallet's UTXO set is not enough to cover recipient's requested plus fee - InsufficientFunds { - /// Sats needed for some transaction - needed: u64, - /// Sats available for spending - available: u64, - }, /// Cannot build a tx without recipients NoRecipients, /// Partially signed bitcoin transaction error @@@ -175,14 -170,13 +168,7 @@@ impl fmt::Display for CreateTxError CreateTxError::OutputBelowDustLimit(limit) => { write!(f, "Output below the dust limit: {}", limit) } - CreateTxError::ChangePolicyDescriptor => { - write!( - f, - "The `change_policy` can be set only if the wallet has a change_descriptor" - ) - } CreateTxError::CoinSelection(e) => e.fmt(f), - CreateTxError::InsufficientFunds { needed, available } => { - write!( - f, - "Insufficient funds: {} sat available of {} sat needed", - available, needed - ) - } CreateTxError::NoRecipients => { write!(f, "Cannot build tx without recipients") }