@@ -346,16 +346,16 @@ impl<'a, 'b, P: PayerIdStrategy, T: secp256k1::Signing> InvoiceRequestBuilder<'a
346
346
/// A semantically valid [`InvoiceRequest`] that hasn't been signed.
347
347
pub struct UnsignedInvoiceRequest {
348
348
bytes : Vec < u8 > ,
349
- invoice_request : InvoiceRequestContents ,
349
+ contents : InvoiceRequestContents ,
350
350
tagged_hash : TaggedHash ,
351
351
}
352
352
353
353
impl UnsignedInvoiceRequest {
354
- fn new ( offer : & Offer , invoice_request : InvoiceRequestContents ) -> Self {
354
+ fn new ( offer : & Offer , contents : InvoiceRequestContents ) -> Self {
355
355
// Use the offer bytes instead of the offer TLV stream as the offer may have contained
356
356
// unknown TLV records, which are not stored in `OfferContents`.
357
357
let ( payer_tlv_stream, _offer_tlv_stream, invoice_request_tlv_stream) =
358
- invoice_request . as_tlv_stream ( ) ;
358
+ contents . as_tlv_stream ( ) ;
359
359
let offer_bytes = WithoutLength ( & offer. bytes ) ;
360
360
let unsigned_tlv_stream = ( payer_tlv_stream, offer_bytes, invoice_request_tlv_stream) ;
361
361
@@ -364,7 +364,7 @@ impl UnsignedInvoiceRequest {
364
364
365
365
let tagged_hash = TaggedHash :: new ( SIGNATURE_TAG , & bytes) ;
366
366
367
- Self { bytes, invoice_request , tagged_hash }
367
+ Self { bytes, contents , tagged_hash }
368
368
}
369
369
370
370
/// Signs the invoice request using the given function.
@@ -374,7 +374,7 @@ impl UnsignedInvoiceRequest {
374
374
where
375
375
F : FnOnce ( & Self ) -> Result < Signature , E >
376
376
{
377
- let pubkey = self . invoice_request . payer_id ;
377
+ let pubkey = self . contents . payer_id ;
378
378
let signature = merkle:: sign_message ( sign, & self , pubkey) ?;
379
379
380
380
// Append the signature TLV record to the bytes.
@@ -385,7 +385,7 @@ impl UnsignedInvoiceRequest {
385
385
386
386
Ok ( InvoiceRequest {
387
387
bytes : self . bytes ,
388
- contents : self . invoice_request ,
388
+ contents : self . contents ,
389
389
signature,
390
390
} )
391
391
}
@@ -1681,7 +1681,7 @@ mod tests {
1681
1681
. build ( ) . unwrap ( ) ;
1682
1682
let unsigned_invoice_request = offer. request_invoice ( vec ! [ 1 ; 32 ] , payer_pubkey ( ) ) . unwrap ( )
1683
1683
. build ( ) . unwrap ( ) ;
1684
- let mut tlv_stream = unsigned_invoice_request. invoice_request . as_tlv_stream ( ) ;
1684
+ let mut tlv_stream = unsigned_invoice_request. contents . as_tlv_stream ( ) ;
1685
1685
tlv_stream. 0 . metadata = None ;
1686
1686
1687
1687
let mut buffer = Vec :: new ( ) ;
@@ -1702,7 +1702,7 @@ mod tests {
1702
1702
. build ( ) . unwrap ( ) ;
1703
1703
let unsigned_invoice_request = offer. request_invoice ( vec ! [ 1 ; 32 ] , payer_pubkey ( ) ) . unwrap ( )
1704
1704
. build ( ) . unwrap ( ) ;
1705
- let mut tlv_stream = unsigned_invoice_request. invoice_request . as_tlv_stream ( ) ;
1705
+ let mut tlv_stream = unsigned_invoice_request. contents . as_tlv_stream ( ) ;
1706
1706
tlv_stream. 2 . payer_id = None ;
1707
1707
1708
1708
let mut buffer = Vec :: new ( ) ;
@@ -1721,7 +1721,7 @@ mod tests {
1721
1721
. build ( ) . unwrap ( ) ;
1722
1722
let unsigned_invoice_request = offer. request_invoice ( vec ! [ 1 ; 32 ] , payer_pubkey ( ) ) . unwrap ( )
1723
1723
. build ( ) . unwrap ( ) ;
1724
- let mut tlv_stream = unsigned_invoice_request. invoice_request . as_tlv_stream ( ) ;
1724
+ let mut tlv_stream = unsigned_invoice_request. contents . as_tlv_stream ( ) ;
1725
1725
tlv_stream. 1 . node_id = None ;
1726
1726
1727
1727
let mut buffer = Vec :: new ( ) ;
@@ -1743,7 +1743,7 @@ mod tests {
1743
1743
. build ( ) . unwrap ( )
1744
1744
. request_invoice ( vec ! [ 1 ; 32 ] , payer_pubkey ( ) ) . unwrap ( )
1745
1745
. build ( ) . unwrap ( )
1746
- . invoice_request
1746
+ . contents
1747
1747
. write ( & mut buffer) . unwrap ( ) ;
1748
1748
1749
1749
match InvoiceRequest :: try_from ( buffer) {
0 commit comments