@@ -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 random identifier for the invoice. When an `Event::StaticInvoiceRequested` comes in for
1611+ /// A random 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 ///
@@ -1623,6 +1623,37 @@ pub enum Event {
16231623 /// [`Offer`]: crate::offers::offer::Offer
16241624 invoice_persisted_path : Responder ,
16251625 } ,
1626+ /// As a static invoice server, we received an [`InvoiceRequest`] on behalf of an often-offline
1627+ /// recipient for whom we are serving [`StaticInvoice`]s.
1628+ ///
1629+ /// This event will only be generated if we previously created paths using
1630+ /// [`ChannelManager::blinded_paths_for_async_recipient`] and the recipient was configured with
1631+ /// them via [`ChannelManager::set_paths_to_static_invoice_server`].
1632+ ///
1633+ /// If we previously persisted a [`StaticInvoice`] from an [`Event::PersistStaticInvoice`] that
1634+ /// matches the below `recipient_id` and `invoice_id`, that invoice should be retrieved now
1635+ /// and forwarded to the payer via [`ChannelManager::send_static_invoice`].
1636+ ///
1637+ /// [`ChannelManager::blinded_paths_for_async_recipient`]: crate::ln::channelmanager::ChannelManager::blinded_paths_for_async_recipient
1638+ /// [`ChannelManager::set_paths_to_static_invoice_server`]: crate::ln::channelmanager::ChannelManager::set_paths_to_static_invoice_server
1639+ /// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
1640+ /// [`ChannelManager::send_static_invoice`]: crate::ln::channelmanager::ChannelManager::send_static_invoice
1641+ #[ cfg( async_payments) ]
1642+ StaticInvoiceRequested {
1643+ /// An identifier for the recipient previously surfaced in
1644+ /// [`Event::PersistStaticInvoice::recipient_id`]. Useful when paired with the `invoice_id` to
1645+ /// retrieve the [`StaticInvoice`] requested by the payer.
1646+ recipient_id : Vec < u8 > ,
1647+ /// A random identifier for the invoice being requested, previously surfaced in
1648+ /// [`Event::PersistStaticInvoice::invoice_id`]. Useful when paired with the `recipient_id` to
1649+ /// retrieve the [`StaticInvoice`] requested by the payer.
1650+ invoice_id : u128 ,
1651+ /// The path over which the [`StaticInvoice`] will be sent to the payer, which should be
1652+ /// provided to [`ChannelManager::send_static_invoice`] along with the invoice.
1653+ ///
1654+ /// [`ChannelManager::send_static_invoice`]: crate::ln::channelmanager::ChannelManager::send_static_invoice
1655+ reply_path : Responder ,
1656+ } ,
16261657}
16271658
16281659impl Writeable for Event {
@@ -2059,6 +2090,11 @@ impl Writeable for Event {
20592090 // No need to write these events because we can just restart the static invoice negotiation
20602091 // on startup.
20612092 } ,
2093+ #[ cfg( async_payments) ]
2094+ & Event :: StaticInvoiceRequested { .. } => {
2095+ 47u8 . write ( writer) ?;
2096+ // Never write StaticInvoiceRequested events as buffered onion messages aren't serialized.
2097+ } ,
20622098 // Note that, going forward, all new events must only write data inside of
20632099 // `write_tlv_fields`. Versions 0.0.101+ will ignore odd-numbered events that write
20642100 // data via `write_tlv_fields`.
@@ -2633,6 +2669,9 @@ impl MaybeReadable for Event {
26332669 // Note that we do not write a length-prefixed TLV for PersistStaticInvoice events.
26342670 #[ cfg( async_payments) ]
26352671 45u8 => Ok ( None ) ,
2672+ // Note that we do not write a length-prefixed TLV for StaticInvoiceRequested events.
2673+ #[ cfg( async_payments) ]
2674+ 47u8 => Ok ( None ) ,
26362675 // Versions prior to 0.0.100 did not ignore odd types, instead returning InvalidValue.
26372676 // Version 0.0.100 failed to properly ignore odd types, possibly resulting in corrupt
26382677 // reads.
0 commit comments