@@ -16,7 +16,7 @@ use crate::descriptor::DescriptorError;
1616use crate :: wallet:: coin_selection;
1717use crate :: { descriptor, wallet, FeeRate , KeychainKind } ;
1818use alloc:: string:: String ;
19- use bitcoin:: { absolute, psbt, OutPoint , Sequence } ;
19+ use bitcoin:: { absolute, psbt, OutPoint , Sequence , Txid } ;
2020use core:: fmt;
2121
2222/// Old catch-all errors enum that can be thrown by the [`Wallet`](crate::wallet::Wallet)
@@ -26,12 +26,6 @@ pub enum Error {
2626 Generic ( String ) ,
2727 /// Happens when trying to spend an UTXO that is not in the internal database
2828 UnknownUtxo ,
29- /// Thrown when a tx is not found in the internal database
30- TransactionNotFound ,
31- /// Happens when trying to bump a transaction that is already confirmed
32- TransactionConfirmed ,
33- /// Trying to replace a tx that has a sequence >= `0xFFFFFFFE`
34- IrreplaceableTransaction ,
3529 /// Node doesn't have data to estimate a fee rate
3630 FeeRateUnavailable ,
3731 /// Error while working with [`keys`](crate::keys)
@@ -84,11 +78,6 @@ impl fmt::Display for Error {
8478 match self {
8579 Self :: Generic ( err) => write ! ( f, "Generic error: {}" , err) ,
8680 Self :: UnknownUtxo => write ! ( f, "UTXO not found in the internal database" ) ,
87- Self :: TransactionNotFound => {
88- write ! ( f, "Transaction not found in the internal database" )
89- }
90- Self :: TransactionConfirmed => write ! ( f, "Transaction already confirmed" ) ,
91- Self :: IrreplaceableTransaction => write ! ( f, "Transaction can't be replaced" ) ,
9281 Self :: FeeRateUnavailable => write ! ( f, "Fee rate unavailable" ) ,
9382 Self :: Key ( err) => write ! ( f, "Key error: {}" , err) ,
9483 Self :: ChecksumMismatch => write ! ( f, "Descriptor checksum mismatch" ) ,
@@ -144,6 +133,8 @@ impl_error!(bitcoin::psbt::Error, Psbt);
144133
145134#[ derive( Debug ) ]
146135/// Error returned from [`TxBuilder::finish`]
136+ ///
137+ /// [`TxBuilder::finish`]: crate::wallet::tx_builder::TxBuilder::finish
147138pub enum CreateTxError < P > {
148139 /// There was a problem with the descriptors passed in
149140 Descriptor ( DescriptorError ) ,
@@ -342,3 +333,64 @@ impl<P> From<coin_selection::Error> for CreateTxError<P> {
342333
343334#[ cfg( feature = "std" ) ]
344335impl < P : core:: fmt:: Display + core:: fmt:: Debug > std:: error:: Error for CreateTxError < P > { }
336+
337+ //
338+
339+ #[ derive( Debug ) ]
340+ /// Error returned from [`Wallet::build_fee_bump`]
341+ ///
342+ /// [`Wallet::build_fee_bump`]: wallet::Wallet::build_fee_bump
343+ pub enum BuildFeeBumpError {
344+ /// Happens when trying to spend an UTXO that is not in the internal database
345+ UnknownUtxo {
346+ /// The outpoint of the missing UTXO
347+ outpoint : OutPoint ,
348+ } ,
349+ /// Thrown when a tx is not found in the internal database
350+ TransactionNotFound {
351+ /// The txid of the missing transaction
352+ txid : Txid ,
353+ } ,
354+ /// Happens when trying to bump a transaction that is already confirmed
355+ TransactionConfirmed {
356+ /// The txid of the already confirmed transaction
357+ txid : Txid ,
358+ } ,
359+ /// Trying to replace a tx that has a sequence >= `0xFFFFFFFE`
360+ IrreplaceableTransaction {
361+ /// The txid of the irreplaceable transaction
362+ txid : Txid ,
363+ } ,
364+ /// Node doesn't have data to estimate a fee rate
365+ FeeRateUnavailable ,
366+ }
367+
368+ #[ cfg( feature = "std" ) ]
369+ impl fmt:: Display for BuildFeeBumpError {
370+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
371+ match self {
372+ Self :: UnknownUtxo { outpoint } => write ! (
373+ f,
374+ "UTXO not found in the internal database with txid: {}, vout: {}" ,
375+ outpoint. txid, outpoint. vout
376+ ) ,
377+ Self :: TransactionNotFound { txid } => {
378+ write ! (
379+ f,
380+ "Transaction not found in the internal database with txid: {}" ,
381+ txid
382+ )
383+ }
384+ Self :: TransactionConfirmed { txid } => {
385+ write ! ( f, "Transaction already confirmed with txid: {}" , txid)
386+ }
387+ Self :: IrreplaceableTransaction { txid } => {
388+ write ! ( f, "Transaction can't be replaced with txid: {}" , txid)
389+ }
390+ Self :: FeeRateUnavailable => write ! ( f, "Fee rate unavailable" ) ,
391+ }
392+ }
393+ }
394+
395+ #[ cfg( feature = "std" ) ]
396+ impl std:: error:: Error for BuildFeeBumpError { }
0 commit comments