diff --git a/crates/wallet/src/wallet/error.rs b/crates/wallet/src/wallet/error.rs index 3504b7d2..7b19a2ec 100644 --- a/crates/wallet/src/wallet/error.rs +++ b/crates/wallet/src/wallet/error.rs @@ -92,13 +92,6 @@ pub enum CreateTxError { OutputBelowDustLimit(usize), /// 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 @@ -176,13 +169,6 @@ impl fmt::Display for CreateTxError { write!(f, "Output below the dust limit: {}", limit) } 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") } diff --git a/crates/wallet/src/wallet/mod.rs b/crates/wallet/src/wallet/mod.rs index 92b12014..0d661727 100644 --- a/crates/wallet/src/wallet/mod.rs +++ b/crates/wallet/src/wallet/mod.rs @@ -73,6 +73,8 @@ use crate::types::*; use crate::wallet::coin_selection::Excess::{Change, NoChange}; use crate::wallet::error::{BuildFeeBumpError, CreateTxError, MiniscriptPsbtError}; +use self::coin_selection::Error; + const COINBASE_MATURITY: u32 = 100; /// A Bitcoin wallet @@ -1562,10 +1564,10 @@ impl Wallet { change_fee, } = excess { - return Err(CreateTxError::InsufficientFunds { + return Err(CreateTxError::CoinSelection(Error::InsufficientFunds { needed: *dust_threshold, available: remaining_amount.saturating_sub(*change_fee), - }); + })); } } else { return Err(CreateTxError::NoRecipients);