@@ -22,6 +22,7 @@ use crate::types::features::BlindedHopFeatures;
22
22
use crate :: ln:: msgs:: DecodeError ;
23
23
use crate :: ln:: onion_utils;
24
24
use crate :: offers:: invoice_request:: InvoiceRequestFields ;
25
+ use crate :: offers:: nonce:: Nonce ;
25
26
use crate :: offers:: offer:: OfferId ;
26
27
use crate :: routing:: gossip:: { NodeId , ReadOnlyNetworkGraph } ;
27
28
use crate :: sign:: { EntropySource , NodeSigner , Recipient } ;
@@ -318,6 +319,11 @@ pub enum PaymentContext {
318
319
/// [`Offer`]: crate::offers::offer::Offer
319
320
Bolt12Offer ( Bolt12OfferContext ) ,
320
321
322
+ /// The payment was made for a static invoice requested from a BOLT 12 [`Offer`].
323
+ ///
324
+ /// [`Offer`]: crate::offers::offer::Offer
325
+ AsyncBolt12Offer ( AsyncBolt12OfferContext ) ,
326
+
321
327
/// The payment was made for an invoice sent for a BOLT 12 [`Refund`].
322
328
///
323
329
/// [`Refund`]: crate::offers::refund::Refund
@@ -351,6 +357,22 @@ pub struct Bolt12OfferContext {
351
357
pub invoice_request : InvoiceRequestFields ,
352
358
}
353
359
360
+ /// The context of a payment made for a static invoice requested from a BOLT 12 [`Offer`].
361
+ ///
362
+ /// [`Offer`]: crate::offers::offer::Offer
363
+ #[ derive( Clone , Debug , Eq , PartialEq ) ]
364
+ pub struct AsyncBolt12OfferContext {
365
+ /// The identifier of the [`Offer`].
366
+ ///
367
+ /// [`Offer`]: crate::offers::offer::Offer
368
+ pub offer_id : OfferId ,
369
+ /// The [`Nonce`] used to verify that an inbound [`InvoiceRequest`] corresponds to this static
370
+ /// invoice's offer.
371
+ ///
372
+ /// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
373
+ pub offer_nonce : Nonce ,
374
+ }
375
+
354
376
/// The context of a payment made for an invoice sent for a BOLT 12 [`Refund`].
355
377
///
356
378
/// [`Refund`]: crate::offers::refund::Refund
@@ -590,6 +612,7 @@ impl_writeable_tlv_based_enum_legacy!(PaymentContext,
590
612
( 0 , Unknown ) ,
591
613
( 1 , Bolt12Offer ) ,
592
614
( 2 , Bolt12Refund ) ,
615
+ ( 3 , AsyncBolt12Offer ) ,
593
616
) ;
594
617
595
618
impl < ' a > Writeable for PaymentContextRef < ' a > {
@@ -626,6 +649,11 @@ impl_writeable_tlv_based!(Bolt12OfferContext, {
626
649
( 2 , invoice_request, required) ,
627
650
} ) ;
628
651
652
+ impl_writeable_tlv_based ! ( AsyncBolt12OfferContext , {
653
+ ( 0 , offer_id, required) ,
654
+ ( 2 , offer_nonce, required) ,
655
+ } ) ;
656
+
629
657
impl_writeable_tlv_based ! ( Bolt12RefundContext , { } ) ;
630
658
631
659
#[ cfg( test) ]
0 commit comments