@@ -1511,11 +1511,11 @@ pub enum Event {
1511
1511
#[ cfg( async_payments) ]
1512
1512
PersistStaticInvoice {
1513
1513
/// The invoice that should be persisted and later provided to payers when handling a future
1514
- /// `Event::StaticInvoiceRequested`.
1514
+ /// [ `Event::StaticInvoiceRequested`] .
1515
1515
invoice : StaticInvoice ,
1516
1516
/// An identifier for the recipient, originally surfaced in
1517
1517
/// [`ChannelManager::blinded_paths_for_async_recipient`]. When an
1518
- /// `Event::StaticInvoiceRequested` comes in for this invoice, this id will be surfaced so the
1518
+ /// [ `Event::StaticInvoiceRequested`] comes in for this invoice, this id will be surfaced so the
1519
1519
/// persisted invoice can be retrieved from the database.
1520
1520
recipient_id_nonce : Nonce ,
1521
1521
/// Once the [`StaticInvoice`] is persisted, [`ChannelManager::static_invoice_persisted`] should
@@ -1526,6 +1526,34 @@ pub enum Event {
1526
1526
/// [`Offer`]: crate::offers::offer::Offer
1527
1527
invoice_persisted_paths : Vec < BlindedMessagePath > ,
1528
1528
} ,
1529
+ /// We received an [`InvoiceRequest`] on behalf of an often-offline recipient for whom we are
1530
+ /// serving [`StaticInvoice`]s.
1531
+ ///
1532
+ /// This event will only be generated if we previously created paths using
1533
+ /// [`ChannelManager::blinded_paths_for_async_recipient`] and configured the recipient with them
1534
+ /// via [`UserConfig::paths_to_static_invoice_server`].
1535
+ ///
1536
+ /// If we previously persisted a [`StaticInvoice`] from an [`Event::PersistStaticInvoice`] that
1537
+ /// matches the contained [`Event::StaticInvoiceRequested::recipient_id_nonce`], that
1538
+ /// invoice should be retrieved now and forwarded to the payer via
1539
+ /// [`ChannelManager::send_static_invoice`].
1540
+ ///
1541
+ /// [`ChannelManager::blinded_paths_for_async_recipient`]: crate::ln::channelmanager::ChannelManager::blinded_paths_for_async_recipient
1542
+ /// [`UserConfig::paths_to_static_invoice_server`]: crate::util::config::UserConfig::paths_to_static_invoice_server
1543
+ /// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
1544
+ /// [`ChannelManager::send_static_invoice`]: crate::ln::channelmanager::ChannelManager::send_static_invoice
1545
+ #[ cfg( async_payments) ]
1546
+ StaticInvoiceRequested {
1547
+ /// An identifier for the recipient previously surfaced in
1548
+ /// [`Event::PersistStaticInvoice::recipient_id_nonce`]. Useful to retrieve the [`StaticInvoice`]
1549
+ /// requested by the payer.
1550
+ recipient_id_nonce : Nonce ,
1551
+ /// The path over which the [`StaticInvoice`] will be sent to the payer, which should be
1552
+ /// provided to [`ChannelManager::send_static_invoice`] along with the invoice.
1553
+ ///
1554
+ /// [`ChannelManager::send_static_invoice`]: crate::ln::channelmanager::ChannelManager::send_static_invoice
1555
+ reply_path : BlindedMessagePath ,
1556
+ } ,
1529
1557
}
1530
1558
1531
1559
impl Writeable for Event {
@@ -1868,6 +1896,14 @@ impl Writeable for Event {
1868
1896
( 4 , invoice_persisted_paths, required) ,
1869
1897
} ) ;
1870
1898
} ,
1899
+ #[ cfg( async_payments) ]
1900
+ & Event :: StaticInvoiceRequested { ref recipient_id_nonce, ref reply_path } => {
1901
+ 47u8 . write ( writer) ?;
1902
+ write_tlv_fields ! ( writer, {
1903
+ ( 0 , recipient_id_nonce, required) ,
1904
+ ( 2 , reply_path, required) ,
1905
+ } ) ;
1906
+ } ,
1871
1907
// Note that, going forward, all new events must only write data inside of
1872
1908
// `write_tlv_fields`. Versions 0.0.101+ will ignore odd-numbered events that write
1873
1909
// data via `write_tlv_fields`.
@@ -2397,6 +2433,20 @@ impl MaybeReadable for Event {
2397
2433
} ;
2398
2434
f ( )
2399
2435
} ,
2436
+ #[ cfg( async_payments) ]
2437
+ 47u8 => {
2438
+ let mut f = || {
2439
+ _init_and_read_len_prefixed_tlv_fields ! ( reader, {
2440
+ ( 0 , recipient_id_nonce, required) ,
2441
+ ( 2 , reply_path, required) ,
2442
+ } ) ;
2443
+ Ok ( Some ( Event :: StaticInvoiceRequested {
2444
+ recipient_id_nonce : _init_tlv_based_struct_field ! ( recipient_id_nonce, required) ,
2445
+ reply_path : _init_tlv_based_struct_field ! ( reply_path, required) ,
2446
+ } ) )
2447
+ } ;
2448
+ f ( )
2449
+ } ,
2400
2450
// Versions prior to 0.0.100 did not ignore odd types, instead returning InvalidValue.
2401
2451
// Version 0.0.100 failed to properly ignore odd types, possibly resulting in corrupt
2402
2452
// reads.
0 commit comments