@@ -1511,11 +1511,11 @@ pub enum Event {
15111511 #[ cfg( async_payments) ]
15121512 PersistStaticInvoice {
15131513 /// The invoice that should be persisted and later provided to payers when handling a future
1514- /// `Event::StaticInvoiceRequested`.
1514+ /// [ `Event::StaticInvoiceRequested`] .
15151515 invoice : StaticInvoice ,
15161516 /// An identifier for the recipient, originally surfaced in
15171517 /// [`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
15191519 /// persisted invoice can be retrieved from the database.
15201520 recipient_id_nonce : Nonce ,
15211521 /// Once the [`StaticInvoice`] is persisted, [`ChannelManager::static_invoice_persisted`] should
@@ -1526,6 +1526,34 @@ pub enum Event {
15261526 /// [`Offer`]: crate::offers::offer::Offer
15271527 invoice_persisted_paths : Vec < BlindedMessagePath > ,
15281528 } ,
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+ } ,
15291557}
15301558
15311559impl Writeable for Event {
@@ -1868,6 +1896,14 @@ impl Writeable for Event {
18681896 ( 4 , invoice_persisted_paths, required) ,
18691897 } ) ;
18701898 } ,
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+ } ,
18711907 // Note that, going forward, all new events must only write data inside of
18721908 // `write_tlv_fields`. Versions 0.0.101+ will ignore odd-numbered events that write
18731909 // data via `write_tlv_fields`.
@@ -2397,6 +2433,20 @@ impl MaybeReadable for Event {
23972433 } ;
23982434 f ( )
23992435 } ,
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+ } ,
24002450 // Versions prior to 0.0.100 did not ignore odd types, instead returning InvalidValue.
24012451 // Version 0.0.100 failed to properly ignore odd types, possibly resulting in corrupt
24022452 // reads.
0 commit comments