chore(wallet): remove duplicated InsufficientFunds error member from CreateTxError
review: move back to old error naming
This commit is contained in:
parent
8eef350bd0
commit
29c8a00b43
@ -94,13 +94,6 @@ pub enum CreateTxError {
|
|||||||
ChangePolicyDescriptor,
|
ChangePolicyDescriptor,
|
||||||
/// There was an error with coin selection
|
/// There was an error with coin selection
|
||||||
CoinSelection(coin_selection::Error),
|
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
|
/// Cannot build a tx without recipients
|
||||||
NoRecipients,
|
NoRecipients,
|
||||||
/// Partially signed bitcoin transaction error
|
/// Partially signed bitcoin transaction error
|
||||||
@ -184,13 +177,6 @@ impl fmt::Display for CreateTxError {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
CreateTxError::CoinSelection(e) => e.fmt(f),
|
CreateTxError::CoinSelection(e) => e.fmt(f),
|
||||||
CreateTxError::InsufficientFunds { needed, available } => {
|
|
||||||
write!(
|
|
||||||
f,
|
|
||||||
"Insufficient funds: {} sat available of {} sat needed",
|
|
||||||
available, needed
|
|
||||||
)
|
|
||||||
}
|
|
||||||
CreateTxError::NoRecipients => {
|
CreateTxError::NoRecipients => {
|
||||||
write!(f, "Cannot build tx without recipients")
|
write!(f, "Cannot build tx without recipients")
|
||||||
}
|
}
|
||||||
|
@ -73,6 +73,8 @@ use crate::types::*;
|
|||||||
use crate::wallet::coin_selection::Excess::{Change, NoChange};
|
use crate::wallet::coin_selection::Excess::{Change, NoChange};
|
||||||
use crate::wallet::error::{BuildFeeBumpError, CreateTxError, MiniscriptPsbtError};
|
use crate::wallet::error::{BuildFeeBumpError, CreateTxError, MiniscriptPsbtError};
|
||||||
|
|
||||||
|
use self::coin_selection::Error;
|
||||||
|
|
||||||
const COINBASE_MATURITY: u32 = 100;
|
const COINBASE_MATURITY: u32 = 100;
|
||||||
|
|
||||||
/// A Bitcoin wallet
|
/// A Bitcoin wallet
|
||||||
@ -1595,10 +1597,10 @@ impl Wallet {
|
|||||||
change_fee,
|
change_fee,
|
||||||
} = excess
|
} = excess
|
||||||
{
|
{
|
||||||
return Err(CreateTxError::InsufficientFunds {
|
return Err(CreateTxError::CoinSelection(Error::InsufficientFunds {
|
||||||
needed: *dust_threshold,
|
needed: *dust_threshold,
|
||||||
available: remaining_amount.saturating_sub(*change_fee),
|
available: remaining_amount.saturating_sub(*change_fee),
|
||||||
});
|
}));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return Err(CreateTxError::NoRecipients);
|
return Err(CreateTxError::NoRecipients);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user