3030//! use lightning::offers::offer::Offer;
3131//! use lightning::util::ser::Writeable;
3232//!
33- //! # fn parse() -> Result<(), lightning::offers::parse::ParseError > {
33+ //! # fn parse() -> Result<(), lightning::offers::parse::Bolt12ParseError > {
3434//! let secp_ctx = Secp256k1::new();
3535//! let keys = KeyPair::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[42; 32])?);
3636//! let pubkey = PublicKey::from(keys);
@@ -68,7 +68,7 @@ use crate::ln::msgs::DecodeError;
6868use crate :: offers:: invoice:: { BlindedPayInfo , DerivedSigningPubkey , ExplicitSigningPubkey , InvoiceBuilder } ;
6969use crate :: offers:: merkle:: { SignError , SignatureTlvStream , SignatureTlvStreamRef , self } ;
7070use crate :: offers:: offer:: { Offer , OfferContents , OfferTlvStream , OfferTlvStreamRef } ;
71- use crate :: offers:: parse:: { ParseError , ParsedMessage , SemanticError } ;
71+ use crate :: offers:: parse:: { Bolt12ParseError , ParsedMessage , SemanticError } ;
7272use crate :: offers:: payer:: { PayerContents , PayerTlvStream , PayerTlvStreamRef } ;
7373use crate :: offers:: signer:: { Metadata , MetadataMaterial } ;
7474use crate :: util:: ser:: { HighZeroBytesDroppedBigSize , SeekReadable , WithoutLength , Writeable , Writer } ;
@@ -708,7 +708,7 @@ type PartialInvoiceRequestTlvStreamRef<'a> = (
708708) ;
709709
710710impl TryFrom < Vec < u8 > > for InvoiceRequest {
711- type Error = ParseError ;
711+ type Error = Bolt12ParseError ;
712712
713713 fn try_from ( bytes : Vec < u8 > ) -> Result < Self , Self :: Error > {
714714 let invoice_request = ParsedMessage :: < FullInvoiceRequestTlvStream > :: try_from ( bytes) ?;
@@ -722,7 +722,7 @@ impl TryFrom<Vec<u8>> for InvoiceRequest {
722722 ) ?;
723723
724724 let signature = match signature {
725- None => return Err ( ParseError :: InvalidSemantics ( SemanticError :: MissingSignature ) ) ,
725+ None => return Err ( Bolt12ParseError :: InvalidSemantics ( SemanticError :: MissingSignature ) ) ,
726726 Some ( signature) => signature,
727727 } ;
728728 merkle:: verify_signature ( & signature, SIGNATURE_TAG , & bytes, contents. payer_id ) ?;
@@ -792,7 +792,7 @@ mod tests {
792792 use crate :: offers:: invoice:: { Bolt12Invoice , SIGNATURE_TAG as INVOICE_SIGNATURE_TAG } ;
793793 use crate :: offers:: merkle:: { SignError , SignatureTlvStreamRef , self } ;
794794 use crate :: offers:: offer:: { Amount , OfferBuilder , OfferTlvStreamRef , Quantity } ;
795- use crate :: offers:: parse:: { ParseError , SemanticError } ;
795+ use crate :: offers:: parse:: { Bolt12ParseError , SemanticError } ;
796796 use crate :: offers:: payer:: PayerTlvStreamRef ;
797797 use crate :: offers:: test_utils:: * ;
798798 use crate :: util:: ser:: { BigSize , Writeable } ;
@@ -1438,7 +1438,7 @@ mod tests {
14381438
14391439 match InvoiceRequest :: try_from ( buffer) {
14401440 Ok ( _) => panic ! ( "expected error" ) ,
1441- Err ( e) => assert_eq ! ( e, ParseError :: InvalidSemantics ( SemanticError :: UnsupportedChain ) ) ,
1441+ Err ( e) => assert_eq ! ( e, Bolt12ParseError :: InvalidSemantics ( SemanticError :: UnsupportedChain ) ) ,
14421442 }
14431443 }
14441444
@@ -1483,7 +1483,7 @@ mod tests {
14831483
14841484 match InvoiceRequest :: try_from ( buffer) {
14851485 Ok ( _) => panic ! ( "expected error" ) ,
1486- Err ( e) => assert_eq ! ( e, ParseError :: InvalidSemantics ( SemanticError :: MissingAmount ) ) ,
1486+ Err ( e) => assert_eq ! ( e, Bolt12ParseError :: InvalidSemantics ( SemanticError :: MissingAmount ) ) ,
14871487 }
14881488
14891489 let invoice_request = OfferBuilder :: new ( "foo" . into ( ) , recipient_pubkey ( ) )
@@ -1499,7 +1499,7 @@ mod tests {
14991499
15001500 match InvoiceRequest :: try_from ( buffer) {
15011501 Ok ( _) => panic ! ( "expected error" ) ,
1502- Err ( e) => assert_eq ! ( e, ParseError :: InvalidSemantics ( SemanticError :: InsufficientAmount ) ) ,
1502+ Err ( e) => assert_eq ! ( e, Bolt12ParseError :: InvalidSemantics ( SemanticError :: InsufficientAmount ) ) ,
15031503 }
15041504
15051505 let invoice_request = OfferBuilder :: new ( "foo" . into ( ) , recipient_pubkey ( ) )
@@ -1515,7 +1515,7 @@ mod tests {
15151515 match InvoiceRequest :: try_from ( buffer) {
15161516 Ok ( _) => panic ! ( "expected error" ) ,
15171517 Err ( e) => {
1518- assert_eq ! ( e, ParseError :: InvalidSemantics ( SemanticError :: UnsupportedCurrency ) ) ;
1518+ assert_eq ! ( e, Bolt12ParseError :: InvalidSemantics ( SemanticError :: UnsupportedCurrency ) ) ;
15191519 } ,
15201520 }
15211521
@@ -1533,7 +1533,7 @@ mod tests {
15331533
15341534 match InvoiceRequest :: try_from ( buffer) {
15351535 Ok ( _) => panic ! ( "expected error" ) ,
1536- Err ( e) => assert_eq ! ( e, ParseError :: InvalidSemantics ( SemanticError :: InvalidAmount ) ) ,
1536+ Err ( e) => assert_eq ! ( e, Bolt12ParseError :: InvalidSemantics ( SemanticError :: InvalidAmount ) ) ,
15371537 }
15381538 }
15391539
@@ -1573,7 +1573,7 @@ mod tests {
15731573 match InvoiceRequest :: try_from ( buffer) {
15741574 Ok ( _) => panic ! ( "expected error" ) ,
15751575 Err ( e) => {
1576- assert_eq ! ( e, ParseError :: InvalidSemantics ( SemanticError :: UnexpectedQuantity ) ) ;
1576+ assert_eq ! ( e, Bolt12ParseError :: InvalidSemantics ( SemanticError :: UnexpectedQuantity ) ) ;
15771577 } ,
15781578 }
15791579
@@ -1609,7 +1609,7 @@ mod tests {
16091609
16101610 match InvoiceRequest :: try_from ( buffer) {
16111611 Ok ( _) => panic ! ( "expected error" ) ,
1612- Err ( e) => assert_eq ! ( e, ParseError :: InvalidSemantics ( SemanticError :: InvalidQuantity ) ) ,
1612+ Err ( e) => assert_eq ! ( e, Bolt12ParseError :: InvalidSemantics ( SemanticError :: InvalidQuantity ) ) ,
16131613 }
16141614
16151615 let invoice_request = OfferBuilder :: new ( "foo" . into ( ) , recipient_pubkey ( ) )
@@ -1642,7 +1642,7 @@ mod tests {
16421642
16431643 match InvoiceRequest :: try_from ( buffer) {
16441644 Ok ( _) => panic ! ( "expected error" ) ,
1645- Err ( e) => assert_eq ! ( e, ParseError :: InvalidSemantics ( SemanticError :: MissingQuantity ) ) ,
1645+ Err ( e) => assert_eq ! ( e, Bolt12ParseError :: InvalidSemantics ( SemanticError :: MissingQuantity ) ) ,
16461646 }
16471647
16481648 let invoice_request = OfferBuilder :: new ( "foo" . into ( ) , recipient_pubkey ( ) )
@@ -1658,7 +1658,7 @@ mod tests {
16581658
16591659 match InvoiceRequest :: try_from ( buffer) {
16601660 Ok ( _) => panic ! ( "expected error" ) ,
1661- Err ( e) => assert_eq ! ( e, ParseError :: InvalidSemantics ( SemanticError :: MissingQuantity ) ) ,
1661+ Err ( e) => assert_eq ! ( e, Bolt12ParseError :: InvalidSemantics ( SemanticError :: MissingQuantity ) ) ,
16621662 }
16631663 }
16641664
@@ -1678,7 +1678,7 @@ mod tests {
16781678 match InvoiceRequest :: try_from ( buffer) {
16791679 Ok ( _) => panic ! ( "expected error" ) ,
16801680 Err ( e) => {
1681- assert_eq ! ( e, ParseError :: InvalidSemantics ( SemanticError :: MissingPayerMetadata ) ) ;
1681+ assert_eq ! ( e, Bolt12ParseError :: InvalidSemantics ( SemanticError :: MissingPayerMetadata ) ) ;
16821682 } ,
16831683 }
16841684 }
@@ -1698,7 +1698,7 @@ mod tests {
16981698
16991699 match InvoiceRequest :: try_from ( buffer) {
17001700 Ok ( _) => panic ! ( "expected error" ) ,
1701- Err ( e) => assert_eq ! ( e, ParseError :: InvalidSemantics ( SemanticError :: MissingPayerId ) ) ,
1701+ Err ( e) => assert_eq ! ( e, Bolt12ParseError :: InvalidSemantics ( SemanticError :: MissingPayerId ) ) ,
17021702 }
17031703 }
17041704
@@ -1718,7 +1718,7 @@ mod tests {
17181718 match InvoiceRequest :: try_from ( buffer) {
17191719 Ok ( _) => panic ! ( "expected error" ) ,
17201720 Err ( e) => {
1721- assert_eq ! ( e, ParseError :: InvalidSemantics ( SemanticError :: MissingSigningPubkey ) ) ;
1721+ assert_eq ! ( e, Bolt12ParseError :: InvalidSemantics ( SemanticError :: MissingSigningPubkey ) ) ;
17221722 } ,
17231723 }
17241724 }
@@ -1736,7 +1736,7 @@ mod tests {
17361736
17371737 match InvoiceRequest :: try_from ( buffer) {
17381738 Ok ( _) => panic ! ( "expected error" ) ,
1739- Err ( e) => assert_eq ! ( e, ParseError :: InvalidSemantics ( SemanticError :: MissingSignature ) ) ,
1739+ Err ( e) => assert_eq ! ( e, Bolt12ParseError :: InvalidSemantics ( SemanticError :: MissingSignature ) ) ,
17401740 }
17411741 }
17421742
@@ -1757,7 +1757,7 @@ mod tests {
17571757 match InvoiceRequest :: try_from ( buffer) {
17581758 Ok ( _) => panic ! ( "expected error" ) ,
17591759 Err ( e) => {
1760- assert_eq ! ( e, ParseError :: InvalidSignature ( secp256k1:: Error :: InvalidSignature ) ) ;
1760+ assert_eq ! ( e, Bolt12ParseError :: InvalidSignature ( secp256k1:: Error :: InvalidSignature ) ) ;
17611761 } ,
17621762 }
17631763 }
@@ -1782,7 +1782,7 @@ mod tests {
17821782
17831783 match InvoiceRequest :: try_from ( encoded_invoice_request) {
17841784 Ok ( _) => panic ! ( "expected error" ) ,
1785- Err ( e) => assert_eq ! ( e, ParseError :: Decode ( DecodeError :: InvalidValue ) ) ,
1785+ Err ( e) => assert_eq ! ( e, Bolt12ParseError :: Decode ( DecodeError :: InvalidValue ) ) ,
17861786 }
17871787 }
17881788}
0 commit comments