30
30
//! use lightning::offers::offer::Offer;
31
31
//! use lightning::util::ser::Writeable;
32
32
//!
33
- //! # fn parse() -> Result<(), lightning::offers::parse::ParseError > {
33
+ //! # fn parse() -> Result<(), lightning::offers::parse::Bolt12ParseError > {
34
34
//! let secp_ctx = Secp256k1::new();
35
35
//! let keys = KeyPair::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[42; 32])?);
36
36
//! let pubkey = PublicKey::from(keys);
@@ -68,7 +68,7 @@ use crate::ln::msgs::DecodeError;
68
68
use crate :: offers:: invoice:: { BlindedPayInfo , DerivedSigningPubkey , ExplicitSigningPubkey , InvoiceBuilder } ;
69
69
use crate :: offers:: merkle:: { SignError , SignatureTlvStream , SignatureTlvStreamRef , self } ;
70
70
use crate :: offers:: offer:: { Offer , OfferContents , OfferTlvStream , OfferTlvStreamRef } ;
71
- use crate :: offers:: parse:: { ParseError , ParsedMessage , SemanticError } ;
71
+ use crate :: offers:: parse:: { Bolt12ParseError , ParsedMessage , SemanticError } ;
72
72
use crate :: offers:: payer:: { PayerContents , PayerTlvStream , PayerTlvStreamRef } ;
73
73
use crate :: offers:: signer:: { Metadata , MetadataMaterial } ;
74
74
use crate :: util:: ser:: { HighZeroBytesDroppedBigSize , SeekReadable , WithoutLength , Writeable , Writer } ;
@@ -708,7 +708,7 @@ type PartialInvoiceRequestTlvStreamRef<'a> = (
708
708
) ;
709
709
710
710
impl TryFrom < Vec < u8 > > for InvoiceRequest {
711
- type Error = ParseError ;
711
+ type Error = Bolt12ParseError ;
712
712
713
713
fn try_from ( bytes : Vec < u8 > ) -> Result < Self , Self :: Error > {
714
714
let invoice_request = ParsedMessage :: < FullInvoiceRequestTlvStream > :: try_from ( bytes) ?;
@@ -722,7 +722,7 @@ impl TryFrom<Vec<u8>> for InvoiceRequest {
722
722
) ?;
723
723
724
724
let signature = match signature {
725
- None => return Err ( ParseError :: InvalidSemantics ( SemanticError :: MissingSignature ) ) ,
725
+ None => return Err ( Bolt12ParseError :: InvalidSemantics ( SemanticError :: MissingSignature ) ) ,
726
726
Some ( signature) => signature,
727
727
} ;
728
728
merkle:: verify_signature ( & signature, SIGNATURE_TAG , & bytes, contents. payer_id ) ?;
@@ -792,7 +792,7 @@ mod tests {
792
792
use crate :: offers:: invoice:: { Bolt12Invoice , SIGNATURE_TAG as INVOICE_SIGNATURE_TAG } ;
793
793
use crate :: offers:: merkle:: { SignError , SignatureTlvStreamRef , self } ;
794
794
use crate :: offers:: offer:: { Amount , OfferBuilder , OfferTlvStreamRef , Quantity } ;
795
- use crate :: offers:: parse:: { ParseError , SemanticError } ;
795
+ use crate :: offers:: parse:: { Bolt12ParseError , SemanticError } ;
796
796
use crate :: offers:: payer:: PayerTlvStreamRef ;
797
797
use crate :: offers:: test_utils:: * ;
798
798
use crate :: util:: ser:: { BigSize , Writeable } ;
@@ -1438,7 +1438,7 @@ mod tests {
1438
1438
1439
1439
match InvoiceRequest :: try_from ( buffer) {
1440
1440
Ok ( _) => panic ! ( "expected error" ) ,
1441
- Err ( e) => assert_eq ! ( e, ParseError :: InvalidSemantics ( SemanticError :: UnsupportedChain ) ) ,
1441
+ Err ( e) => assert_eq ! ( e, Bolt12ParseError :: InvalidSemantics ( SemanticError :: UnsupportedChain ) ) ,
1442
1442
}
1443
1443
}
1444
1444
@@ -1483,7 +1483,7 @@ mod tests {
1483
1483
1484
1484
match InvoiceRequest :: try_from ( buffer) {
1485
1485
Ok ( _) => panic ! ( "expected error" ) ,
1486
- Err ( e) => assert_eq ! ( e, ParseError :: InvalidSemantics ( SemanticError :: MissingAmount ) ) ,
1486
+ Err ( e) => assert_eq ! ( e, Bolt12ParseError :: InvalidSemantics ( SemanticError :: MissingAmount ) ) ,
1487
1487
}
1488
1488
1489
1489
let invoice_request = OfferBuilder :: new ( "foo" . into ( ) , recipient_pubkey ( ) )
@@ -1499,7 +1499,7 @@ mod tests {
1499
1499
1500
1500
match InvoiceRequest :: try_from ( buffer) {
1501
1501
Ok ( _) => panic ! ( "expected error" ) ,
1502
- Err ( e) => assert_eq ! ( e, ParseError :: InvalidSemantics ( SemanticError :: InsufficientAmount ) ) ,
1502
+ Err ( e) => assert_eq ! ( e, Bolt12ParseError :: InvalidSemantics ( SemanticError :: InsufficientAmount ) ) ,
1503
1503
}
1504
1504
1505
1505
let invoice_request = OfferBuilder :: new ( "foo" . into ( ) , recipient_pubkey ( ) )
@@ -1515,7 +1515,7 @@ mod tests {
1515
1515
match InvoiceRequest :: try_from ( buffer) {
1516
1516
Ok ( _) => panic ! ( "expected error" ) ,
1517
1517
Err ( e) => {
1518
- assert_eq ! ( e, ParseError :: InvalidSemantics ( SemanticError :: UnsupportedCurrency ) ) ;
1518
+ assert_eq ! ( e, Bolt12ParseError :: InvalidSemantics ( SemanticError :: UnsupportedCurrency ) ) ;
1519
1519
} ,
1520
1520
}
1521
1521
@@ -1533,7 +1533,7 @@ mod tests {
1533
1533
1534
1534
match InvoiceRequest :: try_from ( buffer) {
1535
1535
Ok ( _) => panic ! ( "expected error" ) ,
1536
- Err ( e) => assert_eq ! ( e, ParseError :: InvalidSemantics ( SemanticError :: InvalidAmount ) ) ,
1536
+ Err ( e) => assert_eq ! ( e, Bolt12ParseError :: InvalidSemantics ( SemanticError :: InvalidAmount ) ) ,
1537
1537
}
1538
1538
}
1539
1539
@@ -1573,7 +1573,7 @@ mod tests {
1573
1573
match InvoiceRequest :: try_from ( buffer) {
1574
1574
Ok ( _) => panic ! ( "expected error" ) ,
1575
1575
Err ( e) => {
1576
- assert_eq ! ( e, ParseError :: InvalidSemantics ( SemanticError :: UnexpectedQuantity ) ) ;
1576
+ assert_eq ! ( e, Bolt12ParseError :: InvalidSemantics ( SemanticError :: UnexpectedQuantity ) ) ;
1577
1577
} ,
1578
1578
}
1579
1579
@@ -1609,7 +1609,7 @@ mod tests {
1609
1609
1610
1610
match InvoiceRequest :: try_from ( buffer) {
1611
1611
Ok ( _) => panic ! ( "expected error" ) ,
1612
- Err ( e) => assert_eq ! ( e, ParseError :: InvalidSemantics ( SemanticError :: InvalidQuantity ) ) ,
1612
+ Err ( e) => assert_eq ! ( e, Bolt12ParseError :: InvalidSemantics ( SemanticError :: InvalidQuantity ) ) ,
1613
1613
}
1614
1614
1615
1615
let invoice_request = OfferBuilder :: new ( "foo" . into ( ) , recipient_pubkey ( ) )
@@ -1642,7 +1642,7 @@ mod tests {
1642
1642
1643
1643
match InvoiceRequest :: try_from ( buffer) {
1644
1644
Ok ( _) => panic ! ( "expected error" ) ,
1645
- Err ( e) => assert_eq ! ( e, ParseError :: InvalidSemantics ( SemanticError :: MissingQuantity ) ) ,
1645
+ Err ( e) => assert_eq ! ( e, Bolt12ParseError :: InvalidSemantics ( SemanticError :: MissingQuantity ) ) ,
1646
1646
}
1647
1647
1648
1648
let invoice_request = OfferBuilder :: new ( "foo" . into ( ) , recipient_pubkey ( ) )
@@ -1658,7 +1658,7 @@ mod tests {
1658
1658
1659
1659
match InvoiceRequest :: try_from ( buffer) {
1660
1660
Ok ( _) => panic ! ( "expected error" ) ,
1661
- Err ( e) => assert_eq ! ( e, ParseError :: InvalidSemantics ( SemanticError :: MissingQuantity ) ) ,
1661
+ Err ( e) => assert_eq ! ( e, Bolt12ParseError :: InvalidSemantics ( SemanticError :: MissingQuantity ) ) ,
1662
1662
}
1663
1663
}
1664
1664
@@ -1678,7 +1678,7 @@ mod tests {
1678
1678
match InvoiceRequest :: try_from ( buffer) {
1679
1679
Ok ( _) => panic ! ( "expected error" ) ,
1680
1680
Err ( e) => {
1681
- assert_eq ! ( e, ParseError :: InvalidSemantics ( SemanticError :: MissingPayerMetadata ) ) ;
1681
+ assert_eq ! ( e, Bolt12ParseError :: InvalidSemantics ( SemanticError :: MissingPayerMetadata ) ) ;
1682
1682
} ,
1683
1683
}
1684
1684
}
@@ -1698,7 +1698,7 @@ mod tests {
1698
1698
1699
1699
match InvoiceRequest :: try_from ( buffer) {
1700
1700
Ok ( _) => panic ! ( "expected error" ) ,
1701
- Err ( e) => assert_eq ! ( e, ParseError :: InvalidSemantics ( SemanticError :: MissingPayerId ) ) ,
1701
+ Err ( e) => assert_eq ! ( e, Bolt12ParseError :: InvalidSemantics ( SemanticError :: MissingPayerId ) ) ,
1702
1702
}
1703
1703
}
1704
1704
@@ -1718,7 +1718,7 @@ mod tests {
1718
1718
match InvoiceRequest :: try_from ( buffer) {
1719
1719
Ok ( _) => panic ! ( "expected error" ) ,
1720
1720
Err ( e) => {
1721
- assert_eq ! ( e, ParseError :: InvalidSemantics ( SemanticError :: MissingSigningPubkey ) ) ;
1721
+ assert_eq ! ( e, Bolt12ParseError :: InvalidSemantics ( SemanticError :: MissingSigningPubkey ) ) ;
1722
1722
} ,
1723
1723
}
1724
1724
}
@@ -1736,7 +1736,7 @@ mod tests {
1736
1736
1737
1737
match InvoiceRequest :: try_from ( buffer) {
1738
1738
Ok ( _) => panic ! ( "expected error" ) ,
1739
- Err ( e) => assert_eq ! ( e, ParseError :: InvalidSemantics ( SemanticError :: MissingSignature ) ) ,
1739
+ Err ( e) => assert_eq ! ( e, Bolt12ParseError :: InvalidSemantics ( SemanticError :: MissingSignature ) ) ,
1740
1740
}
1741
1741
}
1742
1742
@@ -1757,7 +1757,7 @@ mod tests {
1757
1757
match InvoiceRequest :: try_from ( buffer) {
1758
1758
Ok ( _) => panic ! ( "expected error" ) ,
1759
1759
Err ( e) => {
1760
- assert_eq ! ( e, ParseError :: InvalidSignature ( secp256k1:: Error :: InvalidSignature ) ) ;
1760
+ assert_eq ! ( e, Bolt12ParseError :: InvalidSignature ( secp256k1:: Error :: InvalidSignature ) ) ;
1761
1761
} ,
1762
1762
}
1763
1763
}
@@ -1782,7 +1782,7 @@ mod tests {
1782
1782
1783
1783
match InvoiceRequest :: try_from ( encoded_invoice_request) {
1784
1784
Ok ( _) => panic ! ( "expected error" ) ,
1785
- Err ( e) => assert_eq ! ( e, ParseError :: Decode ( DecodeError :: InvalidValue ) ) ,
1785
+ Err ( e) => assert_eq ! ( e, Bolt12ParseError :: Decode ( DecodeError :: InvalidValue ) ) ,
1786
1786
}
1787
1787
}
1788
1788
}
0 commit comments