@@ -251,7 +251,7 @@ pub struct InvoiceBuilder<D: tb::Bool, H: tb::Bool, T: tb::Bool, C: tb::Bool, S:
251251/// [`Bolt11Invoice::from_str`]: crate::Bolt11Invoice#impl-FromStr
252252#[ derive( Eq , PartialEq , Debug , Clone , Hash , Ord , PartialOrd ) ]
253253pub struct Bolt11Invoice {
254- signed_invoice : SignedRawInvoice ,
254+ signed_invoice : SignedRawBolt11Invoice ,
255255}
256256
257257/// Represents the description of an invoice which has to be either a directly included string or
@@ -268,23 +268,23 @@ pub enum InvoiceDescription<'f> {
268268 Hash ( & ' f Sha256 ) ,
269269}
270270
271- /// Represents a signed [`RawInvoice `] with cached hash. The signature is not checked and may be
271+ /// Represents a signed [`RawBolt11Invoice `] with cached hash. The signature is not checked and may be
272272/// invalid.
273273///
274274/// # Invariants
275- /// The hash has to be either from the deserialized invoice or from the serialized [`RawInvoice `].
275+ /// The hash has to be either from the deserialized invoice or from the serialized [`RawBolt11Invoice `].
276276#[ derive( Eq , PartialEq , Debug , Clone , Hash , Ord , PartialOrd ) ]
277- pub struct SignedRawInvoice {
278- /// The rawInvoice that the signature belongs to
279- raw_invoice : RawInvoice ,
277+ pub struct SignedRawBolt11Invoice {
278+ /// The raw invoice that the signature belongs to
279+ raw_invoice : RawBolt11Invoice ,
280280
281- /// Hash of the [`RawInvoice `] that will be used to check the signature.
281+ /// Hash of the [`RawBolt11Invoice `] that will be used to check the signature.
282282 ///
283- /// * if the `SignedRawInvoice ` was deserialized the hash is of from the original encoded form,
283+ /// * if the `SignedRawBolt11Invoice ` was deserialized the hash is of from the original encoded form,
284284 /// since it's not guaranteed that encoding it again will lead to the same result since integers
285285 /// could have been encoded with leading zeroes etc.
286- /// * if the `SignedRawInvoice ` was constructed manually the hash will be the calculated hash
287- /// from the [`RawInvoice `]
286+ /// * if the `SignedRawBolt11Invoice ` was constructed manually the hash will be the calculated hash
287+ /// from the [`RawBolt11Invoice `]
288288 hash : [ u8 ; 32 ] ,
289289
290290 /// signature of the payment request
@@ -297,15 +297,15 @@ pub struct SignedRawInvoice {
297297///
298298/// For methods without docs see the corresponding methods in [`Bolt11Invoice`].
299299#[ derive( Eq , PartialEq , Debug , Clone , Hash , Ord , PartialOrd ) ]
300- pub struct RawInvoice {
300+ pub struct RawBolt11Invoice {
301301 /// human readable part
302302 pub hrp : RawHrp ,
303303
304304 /// data part
305305 pub data : RawDataPart ,
306306}
307307
308- /// Data of the [`RawInvoice `] that is encoded in the human readable part.
308+ /// Data of the [`RawBolt11Invoice `] that is encoded in the human readable part.
309309///
310310/// This is not exported to bindings users as we don't yet support `Option<Enum>`
311311#[ derive( Eq , PartialEq , Debug , Clone , Hash , Ord , PartialOrd ) ]
@@ -320,7 +320,7 @@ pub struct RawHrp {
320320 pub si_prefix : Option < SiPrefix > ,
321321}
322322
323- /// Data of the [`RawInvoice `] that is encoded in the data part
323+ /// Data of the [`RawBolt11Invoice `] that is encoded in the data part
324324#[ derive( Eq , PartialEq , Debug , Clone , Hash , Ord , PartialOrd ) ]
325325pub struct RawDataPart {
326326 /// generation time of the invoice
@@ -621,9 +621,9 @@ impl<D: tb::Bool, H: tb::Bool, T: tb::Bool, C: tb::Bool, S: tb::Bool, M: tb::Boo
621621}
622622
623623impl < D : tb:: Bool , H : tb:: Bool , C : tb:: Bool , S : tb:: Bool , M : tb:: Bool > InvoiceBuilder < D , H , tb:: True , C , S , M > {
624- /// Builds a [`RawInvoice `] if no [`CreationError`] occurred while construction any of the
624+ /// Builds a [`RawBolt11Invoice `] if no [`CreationError`] occurred while construction any of the
625625 /// fields.
626- pub fn build_raw ( self ) -> Result < RawInvoice , CreationError > {
626+ pub fn build_raw ( self ) -> Result < RawBolt11Invoice , CreationError > {
627627
628628 // If an error occurred at any time before, return it now
629629 if let Some ( e) = self . error {
@@ -647,7 +647,7 @@ impl<D: tb::Bool, H: tb::Bool, C: tb::Bool, S: tb::Bool, M: tb::Bool> InvoiceBui
647647 tagged_fields,
648648 } ;
649649
650- Ok ( RawInvoice {
650+ Ok ( RawBolt11Invoice {
651651 hrp,
652652 data,
653653 } )
@@ -850,21 +850,21 @@ impl<M: tb::Bool> InvoiceBuilder<tb::True, tb::True, tb::True, tb::True, tb::Tru
850850}
851851
852852
853- impl SignedRawInvoice {
854- /// Disassembles the `SignedRawInvoice ` into its three parts:
853+ impl SignedRawBolt11Invoice {
854+ /// Disassembles the `SignedRawBolt11Invoice ` into its three parts:
855855 /// 1. raw invoice
856856 /// 2. hash of the raw invoice
857857 /// 3. signature
858- pub fn into_parts ( self ) -> ( RawInvoice , [ u8 ; 32 ] , InvoiceSignature ) {
858+ pub fn into_parts ( self ) -> ( RawBolt11Invoice , [ u8 ; 32 ] , InvoiceSignature ) {
859859 ( self . raw_invoice , self . hash , self . signature )
860860 }
861861
862- /// The [`RawInvoice `] which was signed.
863- pub fn raw_invoice ( & self ) -> & RawInvoice {
862+ /// The [`RawBolt11Invoice `] which was signed.
863+ pub fn raw_invoice ( & self ) -> & RawBolt11Invoice {
864864 & self . raw_invoice
865865 }
866866
867- /// The hash of the [`RawInvoice `] that was signed.
867+ /// The hash of the [`RawBolt11Invoice `] that was signed.
868868 pub fn signable_hash ( & self ) -> & [ u8 ; 32 ] {
869869 & self . hash
870870 }
@@ -968,7 +968,7 @@ macro_rules! find_all_extract {
968968}
969969
970970#[ allow( missing_docs) ]
971- impl RawInvoice {
971+ impl RawBolt11Invoice {
972972 /// Hash the HRP as bytes and signatureless data part.
973973 fn hash_from_parts ( hrp_bytes : & [ u8 ] , data_without_signature : & [ u5 ] ) -> [ u8 ; 32 ] {
974974 let preimage = construct_invoice_preimage ( hrp_bytes, data_without_signature) ;
@@ -977,31 +977,31 @@ impl RawInvoice {
977977 hash
978978 }
979979
980- /// Calculate the hash of the encoded `RawInvoice ` which should be signed.
980+ /// Calculate the hash of the encoded `RawBolt11Invoice ` which should be signed.
981981 pub fn signable_hash ( & self ) -> [ u8 ; 32 ] {
982982 use bech32:: ToBase32 ;
983983
984- RawInvoice :: hash_from_parts (
984+ RawBolt11Invoice :: hash_from_parts (
985985 self . hrp . to_string ( ) . as_bytes ( ) ,
986986 & self . data . to_base32 ( )
987987 )
988988 }
989989
990990 /// Signs the invoice using the supplied `sign_method`. This function MAY fail with an error of
991- /// type `E`. Since the signature of a [`SignedRawInvoice `] is not required to be valid there
991+ /// type `E`. Since the signature of a [`SignedRawBolt11Invoice `] is not required to be valid there
992992 /// are no constraints regarding the validity of the produced signature.
993993 ///
994994 /// This is not exported to bindings users as we don't currently support passing function pointers into methods
995995 /// explicitly.
996- pub fn sign < F , E > ( self , sign_method : F ) -> Result < SignedRawInvoice , E >
996+ pub fn sign < F , E > ( self , sign_method : F ) -> Result < SignedRawBolt11Invoice , E >
997997 where F : FnOnce ( & Message ) -> Result < RecoverableSignature , E >
998998 {
999999 let raw_hash = self . signable_hash ( ) ;
10001000 let hash = Message :: from_slice ( & raw_hash[ ..] )
10011001 . expect ( "Hash is 32 bytes long, same as MESSAGE_SIZE" ) ;
10021002 let signature = sign_method ( & hash) ?;
10031003
1004- Ok ( SignedRawInvoice {
1004+ Ok ( SignedRawBolt11Invoice {
10051005 raw_invoice : self ,
10061006 hash : raw_hash,
10071007 signature : InvoiceSignature ( signature) ,
@@ -1143,13 +1143,13 @@ impl From<PositiveTimestamp> for SystemTime {
11431143}
11441144
11451145impl Bolt11Invoice {
1146- /// The hash of the [`RawInvoice `] that was signed.
1146+ /// The hash of the [`RawBolt11Invoice `] that was signed.
11471147 pub fn signable_hash ( & self ) -> [ u8 ; 32 ] {
11481148 self . signed_invoice . hash
11491149 }
11501150
11511151 /// Transform the `Bolt11Invoice` into its unchecked version.
1152- pub fn into_signed_raw ( self ) -> SignedRawInvoice {
1152+ pub fn into_signed_raw ( self ) -> SignedRawBolt11Invoice {
11531153 self . signed_invoice
11541154 }
11551155
@@ -1252,7 +1252,7 @@ impl Bolt11Invoice {
12521252 Ok ( ( ) )
12531253 }
12541254
1255- /// Constructs a `Bolt11Invoice` from a [`SignedRawInvoice `] by checking all its invariants.
1255+ /// Constructs a `Bolt11Invoice` from a [`SignedRawBolt11Invoice `] by checking all its invariants.
12561256 /// ```
12571257 /// use lightning_invoice::*;
12581258 ///
@@ -1268,11 +1268,11 @@ impl Bolt11Invoice {
12681268 /// 8s0gyuxjjgux34w75dnc6xp2l35j7es3jd4ugt3lu0xzre26yg5m7ke54n2d5sym4xcmxtl8238xxvw5h5h5\
12691269 /// j5r6drg6k6zcqj0fcwg";
12701270 ///
1271- /// let signed = invoice.parse::<SignedRawInvoice >().unwrap();
1271+ /// let signed = invoice.parse::<SignedRawBolt11Invoice >().unwrap();
12721272 ///
12731273 /// assert!(Bolt11Invoice::from_signed(signed).is_ok());
12741274 /// ```
1275- pub fn from_signed ( signed_invoice : SignedRawInvoice ) -> Result < Self , SemanticError > {
1275+ pub fn from_signed ( signed_invoice : SignedRawBolt11Invoice ) -> Result < Self , SemanticError > {
12761276 let invoice = Bolt11Invoice {
12771277 signed_invoice,
12781278 } ;
@@ -1599,15 +1599,15 @@ impl Deref for InvoiceSignature {
15991599 }
16001600}
16011601
1602- impl Deref for SignedRawInvoice {
1603- type Target = RawInvoice ;
1602+ impl Deref for SignedRawBolt11Invoice {
1603+ type Target = RawBolt11Invoice ;
16041604
1605- fn deref ( & self ) -> & RawInvoice {
1605+ fn deref ( & self ) -> & RawBolt11Invoice {
16061606 & self . raw_invoice
16071607 }
16081608}
16091609
1610- /// Errors that may occur when constructing a new [`RawInvoice `] or [`Bolt11Invoice`]
1610+ /// Errors that may occur when constructing a new [`RawBolt11Invoice `] or [`Bolt11Invoice`]
16111611#[ derive( Eq , PartialEq , Debug , Clone ) ]
16121612pub enum CreationError {
16131613 /// The supplied description string was longer than 639 __bytes__ (see [`Description::new`])
@@ -1651,7 +1651,7 @@ impl Display for CreationError {
16511651#[ cfg( feature = "std" ) ]
16521652impl std:: error:: Error for CreationError { }
16531653
1654- /// Errors that may occur when converting a [`RawInvoice `] to a [`Bolt11Invoice`]. They relate to
1654+ /// Errors that may occur when converting a [`RawBolt11Invoice `] to a [`Bolt11Invoice`]. They relate to
16551655/// the requirements sections in BOLT #11
16561656#[ derive( Eq , PartialEq , Debug , Clone ) ]
16571657pub enum SemanticError {
@@ -1760,10 +1760,10 @@ mod test {
17601760
17611761 #[ test]
17621762 fn test_calc_invoice_hash ( ) {
1763- use crate :: { RawInvoice , RawHrp , RawDataPart , Currency , PositiveTimestamp } ;
1763+ use crate :: { RawBolt11Invoice , RawHrp , RawDataPart , Currency , PositiveTimestamp } ;
17641764 use crate :: TaggedField :: * ;
17651765
1766- let invoice = RawInvoice {
1766+ let invoice = RawBolt11Invoice {
17671767 hrp : RawHrp {
17681768 currency : Currency :: Bitcoin ,
17691769 raw_amount : None ,
@@ -1797,11 +1797,11 @@ mod test {
17971797 use secp256k1:: Secp256k1 ;
17981798 use secp256k1:: ecdsa:: { RecoveryId , RecoverableSignature } ;
17991799 use secp256k1:: { SecretKey , PublicKey } ;
1800- use crate :: { SignedRawInvoice , InvoiceSignature , RawInvoice , RawHrp , RawDataPart , Currency , Sha256 ,
1800+ use crate :: { SignedRawBolt11Invoice , InvoiceSignature , RawBolt11Invoice , RawHrp , RawDataPart , Currency , Sha256 ,
18011801 PositiveTimestamp } ;
18021802
1803- let invoice = SignedRawInvoice {
1804- raw_invoice : RawInvoice {
1803+ let invoice = SignedRawBolt11Invoice {
1804+ raw_invoice : RawBolt11Invoice {
18051805 hrp : RawHrp {
18061806 currency : Currency :: Bitcoin ,
18071807 raw_amount : None ,
@@ -1866,12 +1866,12 @@ mod test {
18661866 use lightning:: ln:: features:: InvoiceFeatures ;
18671867 use secp256k1:: Secp256k1 ;
18681868 use secp256k1:: SecretKey ;
1869- use crate :: { Bolt11Invoice , RawInvoice , RawHrp , RawDataPart , Currency , Sha256 , PositiveTimestamp ,
1869+ use crate :: { Bolt11Invoice , RawBolt11Invoice , RawHrp , RawDataPart , Currency , Sha256 , PositiveTimestamp ,
18701870 SemanticError } ;
18711871
18721872 let private_key = SecretKey :: from_slice ( & [ 42 ; 32 ] ) . unwrap ( ) ;
18731873 let payment_secret = lightning:: ln:: PaymentSecret ( [ 21 ; 32 ] ) ;
1874- let invoice_template = RawInvoice {
1874+ let invoice_template = RawBolt11Invoice {
18751875 hrp : RawHrp {
18761876 currency : Currency :: Bitcoin ,
18771877 raw_amount : None ,
0 commit comments