@@ -1593,7 +1593,7 @@ pub enum Event {
1593
1593
#[ cfg( async_payments) ]
1594
1594
PersistStaticInvoice {
1595
1595
/// The invoice that should be persisted and later provided to payers when handling a future
1596
- /// `Event::StaticInvoiceRequested`.
1596
+ /// [ `Event::StaticInvoiceRequested`] .
1597
1597
invoice : StaticInvoice ,
1598
1598
/// Useful for the recipient to replace a specific invoice stored by us as the static invoice
1599
1599
/// server.
@@ -1605,10 +1605,10 @@ pub enum Event {
1605
1605
/// An identifier for the recipient, originally provided to
1606
1606
/// [`ChannelManager::blinded_paths_for_async_recipient`].
1607
1607
///
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
1609
1609
/// and can be used alongside the `invoice_id` to retrieve the invoice from the database.
1610
1610
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
1612
1612
/// the invoice, this id will be surfaced and can be used alongside the `recipient_id` to
1613
1613
/// retrieve the invoice from the database.
1614
1614
///
@@ -1623,6 +1623,37 @@ pub enum Event {
1623
1623
/// [`Offer`]: crate::offers::offer::Offer
1624
1624
invoice_persisted_path : Responder ,
1625
1625
} ,
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
+ } ,
1626
1657
}
1627
1658
1628
1659
impl Writeable for Event {
@@ -2059,6 +2090,11 @@ impl Writeable for Event {
2059
2090
// No need to write these events because we can just restart the static invoice negotiation
2060
2091
// on startup.
2061
2092
} ,
2093
+ #[ cfg( async_payments) ]
2094
+ & Event :: StaticInvoiceRequested { .. } => {
2095
+ 47u8 . write ( writer) ?;
2096
+ // Never write StaticInvoiceRequested events as buffered onion messages aren't serialized.
2097
+ } ,
2062
2098
// Note that, going forward, all new events must only write data inside of
2063
2099
// `write_tlv_fields`. Versions 0.0.101+ will ignore odd-numbered events that write
2064
2100
// data via `write_tlv_fields`.
@@ -2633,6 +2669,9 @@ impl MaybeReadable for Event {
2633
2669
// Note that we do not write a length-prefixed TLV for PersistStaticInvoice events.
2634
2670
#[ cfg( async_payments) ]
2635
2671
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 ) ,
2636
2675
// Versions prior to 0.0.100 did not ignore odd types, instead returning InvalidValue.
2637
2676
// Version 0.0.100 failed to properly ignore odd types, possibly resulting in corrupt
2638
2677
// reads.
0 commit comments