Skip to content

Commit b39c548

Browse files
e1a0a0eaoleonardolima
authored andcommitted
chore(wallet): remove duplicated InsufficientFunds error member from CreateTxError
review: move back to old error naming
1 parent c5a3b62 commit b39c548

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

crates/wallet/src/wallet/error.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,6 @@ pub enum CreateTxError {
9292
OutputBelowDustLimit(usize),
9393
/// There was an error with coin selection
9494
CoinSelection(coin_selection::Error),
95-
/// Wallet's UTXO set is not enough to cover recipient's requested plus fee
96-
InsufficientFunds {
97-
/// Sats needed for some transaction
98-
needed: u64,
99-
/// Sats available for spending
100-
available: u64,
101-
},
10295
/// Cannot build a tx without recipients
10396
NoRecipients,
10497
/// Partially signed bitcoin transaction error
@@ -176,13 +169,6 @@ impl fmt::Display for CreateTxError {
176169
write!(f, "Output below the dust limit: {}", limit)
177170
}
178171
CreateTxError::CoinSelection(e) => e.fmt(f),
179-
CreateTxError::InsufficientFunds { needed, available } => {
180-
write!(
181-
f,
182-
"Insufficient funds: {} sat available of {} sat needed",
183-
available, needed
184-
)
185-
}
186172
CreateTxError::NoRecipients => {
187173
write!(f, "Cannot build tx without recipients")
188174
}

crates/wallet/src/wallet/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ use crate::types::*;
7373
use crate::wallet::coin_selection::Excess::{Change, NoChange};
7474
use crate::wallet::error::{BuildFeeBumpError, CreateTxError, MiniscriptPsbtError};
7575

76+
use self::coin_selection::Error;
77+
7678
const COINBASE_MATURITY: u32 = 100;
7779

7880
/// A Bitcoin wallet
@@ -1562,10 +1564,10 @@ impl Wallet {
15621564
change_fee,
15631565
} = excess
15641566
{
1565-
return Err(CreateTxError::InsufficientFunds {
1567+
return Err(CreateTxError::CoinSelection(Error::InsufficientFunds {
15661568
needed: *dust_threshold,
15671569
available: remaining_amount.saturating_sub(*change_fee),
1568-
});
1570+
}));
15691571
}
15701572
} else {
15711573
return Err(CreateTxError::NoRecipients);

0 commit comments

Comments
 (0)