refactor(bdk)!: add context specific error types, remove top level error mod
refactor(bdk)!: remove impl_error macro refactor(wallet)!: add MiniscriptPsbtError, CreateTxError, BuildFeeBumpError error enums refactor(coin_selection)!: add module Error enum test(bdk): use anyhow dev-dependency for all tests
This commit is contained in:
@@ -57,6 +57,7 @@ use crate::{
|
||||
use alloc::collections::vec_deque::VecDeque;
|
||||
use alloc::vec::Vec;
|
||||
use bitcoin::{OutPoint, Script, Transaction, TxOut, Txid};
|
||||
use core::fmt::{self, Formatter};
|
||||
use core::{
|
||||
convert::Infallible,
|
||||
ops::{Deref, RangeInclusive},
|
||||
@@ -145,6 +146,26 @@ pub enum CalculateFeeError {
|
||||
NegativeFee(i64),
|
||||
}
|
||||
|
||||
impl fmt::Display for CalculateFeeError {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
CalculateFeeError::MissingTxOut(outpoints) => write!(
|
||||
f,
|
||||
"missing `TxOut` for one or more of the inputs of the tx: {:?}",
|
||||
outpoints
|
||||
),
|
||||
CalculateFeeError::NegativeFee(fee) => write!(
|
||||
f,
|
||||
"transaction is invalid according to the graph and has negative fee: {}",
|
||||
fee
|
||||
),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl std::error::Error for CalculateFeeError {}
|
||||
|
||||
impl<A> TxGraph<A> {
|
||||
/// Iterate over all tx outputs known by [`TxGraph`].
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user