@@ -23,8 +23,8 @@ use secp256k1::recovery::{RecoveryId, RecoverableSignature};
2323use secp256k1:: key:: PublicKey ;
2424
2525use super :: { Invoice , Sha256 , TaggedField , ExpiryTime , MinFinalCltvExpiry , Fallback , PayeePubKey , InvoiceSignature , PositiveTimestamp ,
26- SemanticError , PrivateRoute , Description , RawTaggedField , Currency , RawHrp , SiPrefix , RawInvoice , constants , SignedRawInvoice ,
27- RawDataPart , InvoiceFeatures } ;
26+ SemanticError , PrivateRoute , ParseError , ParseOrSemanticError , Description , RawTaggedField , Currency , RawHrp , SiPrefix , RawInvoice ,
27+ constants , SignedRawInvoice , RawDataPart , InvoiceFeatures } ;
2828
2929use self :: hrp_sm:: parse_hrp;
3030
@@ -619,46 +619,6 @@ impl FromBase32 for PrivateRoute {
619619 }
620620}
621621
622- /// Errors that indicate what is wrong with the invoice. They have some granularity for debug
623- /// reasons, but should generally result in an "invalid BOLT11 invoice" message for the user.
624- #[ allow( missing_docs) ]
625- #[ derive( PartialEq , Debug , Clone ) ]
626- pub enum ParseError {
627- Bech32Error ( bech32:: Error ) ,
628- ParseAmountError ( ParseIntError ) ,
629- MalformedSignature ( secp256k1:: Error ) ,
630- BadPrefix ,
631- UnknownCurrency ,
632- UnknownSiPrefix ,
633- MalformedHRP ,
634- TooShortDataPart ,
635- UnexpectedEndOfTaggedFields ,
636- DescriptionDecodeError ( str:: Utf8Error ) ,
637- PaddingError ,
638- IntegerOverflowError ,
639- InvalidSegWitProgramLength ,
640- InvalidPubKeyHashLength ,
641- InvalidScriptHashLength ,
642- InvalidRecoveryId ,
643- InvalidSliceLength ( String ) ,
644-
645- /// Not an error, but used internally to signal that a part of the invoice should be ignored
646- /// according to BOLT11
647- Skip ,
648- }
649-
650- /// Indicates that something went wrong while parsing or validating the invoice. Parsing errors
651- /// should be mostly seen as opaque and are only there for debugging reasons. Semantic errors
652- /// like wrong signatures, missing fields etc. could mean that someone tampered with the invoice.
653- #[ derive( PartialEq , Debug , Clone ) ]
654- pub enum ParseOrSemanticError {
655- /// The invoice couldn't be decoded
656- ParseError ( ParseError ) ,
657-
658- /// The invoice could be decoded but violates the BOLT11 standard
659- SemanticError ( :: SemanticError ) ,
660- }
661-
662622impl Display for ParseError {
663623 fn fmt ( & self , f : & mut Formatter ) -> fmt:: Result {
664624 match * self {
0 commit comments