@@ -1593,7 +1593,7 @@ pub enum Event {
15931593 #[ cfg( async_payments) ]
15941594 PersistStaticInvoice {
15951595 /// The invoice that should be persisted and later provided to payers when handling a future
1596- /// `Event::StaticInvoiceRequested`.
1596+ /// [ `Event::StaticInvoiceRequested`] .
15971597 invoice : StaticInvoice ,
15981598 /// Useful for the recipient to replace a specific invoice stored by us as the static invoice
15991599 /// server.
@@ -1605,10 +1605,10 @@ pub enum Event {
16051605 /// An identifier for the recipient, originally provided to
16061606 /// [`ChannelManager::blinded_paths_for_async_recipient`].
16071607 ///
1608- /// When an `Event::StaticInvoiceRequested` comes in for the invoice, this id will be surfaced
1608+ /// When an [ `Event::StaticInvoiceRequested`] comes in for the invoice, this id will be surfaced
16091609 /// and can be used alongside the `invoice_id` to retrieve the invoice from the database.
16101610 recipient_id : Vec < u8 > ,
1611- /// A unique identifier for the invoice. When an `Event::StaticInvoiceRequested` comes in for
1611+ /// A unique identifier for the invoice. When an [ `Event::StaticInvoiceRequested`] comes in for
16121612 /// the invoice, this id will be surfaced and can be used alongside the `recipient_id` to
16131613 /// retrieve the invoice from the database.
16141614 invoice_id : u64 ,
@@ -1620,6 +1620,37 @@ pub enum Event {
16201620 /// [`Offer`]: crate::offers::offer::Offer
16211621 invoice_persisted_path : Responder ,
16221622 } ,
1623+ /// As a static invoice server, we received an [`InvoiceRequest`] on behalf of an often-offline
1624+ /// recipient for whom we are serving [`StaticInvoice`]s.
1625+ ///
1626+ /// This event will only be generated if we previously created paths using
1627+ /// [`ChannelManager::blinded_paths_for_async_recipient`] and the recipient was configured with
1628+ /// them via [`ChannelManager::set_paths_to_static_invoice_server`].
1629+ ///
1630+ /// If we previously persisted a [`StaticInvoice`] from an [`Event::PersistStaticInvoice`] that
1631+ /// matches the below `recipient_id` and `invoice_id`, that invoice should be retrieved now
1632+ /// and forwarded to the payer via [`ChannelManager::send_static_invoice`].
1633+ ///
1634+ /// [`ChannelManager::blinded_paths_for_async_recipient`]: crate::ln::channelmanager::ChannelManager::blinded_paths_for_async_recipient
1635+ /// [`ChannelManager::set_paths_to_static_invoice_server`]: crate::ln::channelmanager::ChannelManager::set_paths_to_static_invoice_server
1636+ /// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
1637+ /// [`ChannelManager::send_static_invoice`]: crate::ln::channelmanager::ChannelManager::send_static_invoice
1638+ #[ cfg( async_payments) ]
1639+ StaticInvoiceRequested {
1640+ /// An identifier for the recipient previously surfaced in
1641+ /// [`Event::PersistStaticInvoice::recipient_id`]. Useful when paired with the `invoice_id` to
1642+ /// retrieve the [`StaticInvoice`] requested by the payer.
1643+ recipient_id : Vec < u8 > ,
1644+ /// A random unique identifier for the invoice being requested, previously surfaced in
1645+ /// [`Event::PersistStaticInvoice::invoice_id`]. Useful when paired with the `recipient_id` to
1646+ /// retrieve the [`StaticInvoice`] requested by the payer.
1647+ invoice_id : u64 ,
1648+ /// The path over which the [`StaticInvoice`] will be sent to the payer, which should be
1649+ /// provided to [`ChannelManager::send_static_invoice`] along with the invoice.
1650+ ///
1651+ /// [`ChannelManager::send_static_invoice`]: crate::ln::channelmanager::ChannelManager::send_static_invoice
1652+ reply_path : Responder ,
1653+ } ,
16231654}
16241655
16251656impl Writeable for Event {
@@ -2056,6 +2087,11 @@ impl Writeable for Event {
20562087 // No need to write these events because we can just restart the static invoice negotiation
20572088 // on startup.
20582089 } ,
2090+ #[ cfg( async_payments) ]
2091+ & Event :: StaticInvoiceRequested { .. } => {
2092+ 47u8 . write ( writer) ?;
2093+ // Never write StaticInvoiceRequested events as buffered onion messages aren't serialized.
2094+ } ,
20592095 // Note that, going forward, all new events must only write data inside of
20602096 // `write_tlv_fields`. Versions 0.0.101+ will ignore odd-numbered events that write
20612097 // data via `write_tlv_fields`.
@@ -2630,6 +2666,9 @@ impl MaybeReadable for Event {
26302666 // Note that we do not write a length-prefixed TLV for PersistStaticInvoice events.
26312667 #[ cfg( async_payments) ]
26322668 45u8 => Ok ( None ) ,
2669+ // Note that we do not write a length-prefixed TLV for StaticInvoiceRequested events.
2670+ #[ cfg( async_payments) ]
2671+ 47u8 => Ok ( None ) ,
26332672 // Versions prior to 0.0.100 did not ignore odd types, instead returning InvalidValue.
26342673 // Version 0.0.100 failed to properly ignore odd types, possibly resulting in corrupt
26352674 // reads.
0 commit comments