@@ -16,13 +16,22 @@ pub struct ValidationError {
1616
1717#[ derive( Debug ) ]
1818pub ( crate ) enum InternalValidationError {
19- Psbt ( bitcoin:: psbt:: PsbtParseError ) ,
19+ PsbtParse ( bitcoin:: psbt:: PsbtParseError ) ,
2020 Io ( std:: io:: Error ) ,
2121 InvalidInputType ( InputTypeError ) ,
2222 InvalidProposedInput ( crate :: psbt:: PrevTxOutError ) ,
23- VersionsDontMatch { proposed : i32 , original : i32 } ,
24- LockTimesDontMatch { proposed : LockTime , original : LockTime } ,
25- SenderTxinSequenceChanged { proposed : Sequence , original : Sequence } ,
23+ VersionsDontMatch {
24+ proposed : i32 ,
25+ original : i32 ,
26+ } ,
27+ LockTimesDontMatch {
28+ proposed : LockTime ,
29+ original : LockTime ,
30+ } ,
31+ SenderTxinSequenceChanged {
32+ proposed : Sequence ,
33+ original : Sequence ,
34+ } ,
2635 SenderTxinContainsNonWitnessUtxo ,
2736 SenderTxinContainsWitnessUtxo ,
2837 SenderTxinContainsFinalScriptSig ,
@@ -32,7 +41,10 @@ pub(crate) enum InternalValidationError {
3241 ReceiverTxinNotFinalized ,
3342 ReceiverTxinMissingUtxoInfo ,
3443 MixedSequence ,
35- MixedInputTypes { proposed : InputType , original : InputType } ,
44+ MixedInputTypes {
45+ proposed : InputType ,
46+ original : InputType ,
47+ } ,
3648 MissingOrShuffledInputs ,
3749 TxOutContainsKeyPaths ,
3850 FeeContributionExceedsMaximum ,
@@ -44,6 +56,10 @@ pub(crate) enum InternalValidationError {
4456 PayeeTookContributedFee ,
4557 FeeContributionPaysOutputSizeIncrease ,
4658 FeeRateBelowMinimum ,
59+ #[ cfg( feature = "v2" ) ]
60+ V2 ( crate :: v2:: Error ) ,
61+ #[ cfg( feature = "v2" ) ]
62+ Psbt ( bitcoin:: psbt:: Error ) ,
4763}
4864
4965impl From < InternalValidationError > for ValidationError {
@@ -58,7 +74,7 @@ impl fmt::Display for ValidationError {
5874 use InternalValidationError :: * ;
5975
6076 match & self . internal {
61- Psbt ( e) => write ! ( f, "couldn't decode PSBT: {}" , e) ,
77+ PsbtParse ( e) => write ! ( f, "couldn't decode PSBT: {}" , e) ,
6278 Io ( e) => write ! ( f, "couldn't read PSBT: {}" , e) ,
6379 InvalidInputType ( e) => write ! ( f, "invalid transaction input type: {}" , e) ,
6480 InvalidProposedInput ( e) => write ! ( f, "invalid proposed transaction input: {}" , e) ,
@@ -86,6 +102,10 @@ impl fmt::Display for ValidationError {
86102 PayeeTookContributedFee => write ! ( f, "payee tried to take fee contribution for himself" ) ,
87103 FeeContributionPaysOutputSizeIncrease => write ! ( f, "fee contribution pays for additional outputs" ) ,
88104 FeeRateBelowMinimum => write ! ( f, "the fee rate of proposed transaction is below minimum" ) ,
105+ #[ cfg( feature = "v2" ) ]
106+ V2 ( e) => write ! ( f, "v2 error: {}" , e) ,
107+ #[ cfg( feature = "v2" ) ]
108+ Psbt ( e) => write ! ( f, "psbt error: {}" , e) ,
89109 }
90110 }
91111}
@@ -95,7 +115,7 @@ impl std::error::Error for ValidationError {
95115 use InternalValidationError :: * ;
96116
97117 match & self . internal {
98- Psbt ( error) => Some ( error) ,
118+ PsbtParse ( error) => Some ( error) ,
99119 Io ( error) => Some ( error) ,
100120 InvalidInputType ( error) => Some ( error) ,
101121 InvalidProposedInput ( error) => Some ( error) ,
@@ -123,6 +143,10 @@ impl std::error::Error for ValidationError {
123143 PayeeTookContributedFee => None ,
124144 FeeContributionPaysOutputSizeIncrease => None ,
125145 FeeRateBelowMinimum => None ,
146+ #[ cfg( feature = "v2" ) ]
147+ V2 ( error) => Some ( error) ,
148+ #[ cfg( feature = "v2" ) ]
149+ Psbt ( error) => Some ( error) ,
126150 }
127151 }
128152}
@@ -152,6 +176,8 @@ pub(crate) enum InternalCreateRequestError {
152176 UriDoesNotSupportPayjoin ,
153177 PrevTxOut ( crate :: psbt:: PrevTxOutError ) ,
154178 InputType ( crate :: input_type:: InputTypeError ) ,
179+ #[ cfg( feature = "v2" ) ]
180+ V2 ( crate :: v2:: Error ) ,
155181}
156182
157183impl fmt:: Display for CreateRequestError {
@@ -174,6 +200,8 @@ impl fmt::Display for CreateRequestError {
174200 UriDoesNotSupportPayjoin => write ! ( f, "the URI does not support payjoin" ) ,
175201 PrevTxOut ( e) => write ! ( f, "invalid previous transaction output: {}" , e) ,
176202 InputType ( e) => write ! ( f, "invalid input type: {}" , e) ,
203+ #[ cfg( feature = "v2" ) ]
204+ V2 ( e) => write ! ( f, "v2 error: {}" , e) ,
177205 }
178206 }
179207}
@@ -198,6 +226,8 @@ impl std::error::Error for CreateRequestError {
198226 UriDoesNotSupportPayjoin => None ,
199227 PrevTxOut ( error) => Some ( error) ,
200228 InputType ( error) => Some ( error) ,
229+ #[ cfg( feature = "v2" ) ]
230+ V2 ( error) => Some ( error) ,
201231 }
202232 }
203233}
0 commit comments