Skip to content

Commit 5ae19b4

Browse files
Merge pull request #4049 from elnosh/server-fwd-invreq
Always-online node forward invoice request
2 parents 84398d9 + f46a3ff commit 5ae19b4

File tree

7 files changed

+563
-71
lines changed

7 files changed

+563
-71
lines changed

lightning-types/src/features.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@
5454
//! - `SimpleClose` - requires/supports simplified closing negotiation
5555
//! (see [BOLT-2](https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#closing-negotiation-closing_complete-and-closing_sig) for more information).
5656
//! - `OnionMessages` - requires/supports forwarding onion messages
57-
//! (see [BOLT-7](https://github.com/lightning/bolts/pull/759/files) for more information).
58-
// TODO: update link
57+
//! (see [BOLT-4](https://github.com/lightning/bolts/blob/master/04-onion-routing.md#onion-messages) for more information).
5958
//! - `ChannelType` - node supports the channel_type field in open/accept
6059
//! (see [BOLT-2](https://github.com/lightning/bolts/blob/master/02-peer-protocol.md) for more information).
6160
//! - `SCIDPrivacy` - supply channel aliases for routing

lightning/src/events/mod.rs

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub mod bump_transaction;
1818

1919
pub use bump_transaction::BumpTransactionEvent;
2020

21-
use crate::blinded_path::message::OffersContext;
21+
use crate::blinded_path::message::{BlindedMessagePath, OffersContext};
2222
use crate::blinded_path::payment::{
2323
Bolt12OfferContext, Bolt12RefundContext, PaymentContext, PaymentContextRef,
2424
};
@@ -28,6 +28,7 @@ use crate::ln::channelmanager::{InterceptId, PaymentId, RecipientOnionFields};
2828
use crate::ln::types::ChannelId;
2929
use crate::ln::{msgs, LocalHTLCFailureReason};
3030
use crate::offers::invoice::Bolt12Invoice;
31+
use crate::offers::invoice_request::InvoiceRequest;
3132
use crate::offers::static_invoice::StaticInvoice;
3233
use crate::onion_message::messenger::Responder;
3334
use crate::routing::gossip::NetworkUpdate;
@@ -1654,6 +1655,13 @@ pub enum Event {
16541655
/// The invoice that should be persisted and later provided to payers when handling a future
16551656
/// [`Event::StaticInvoiceRequested`].
16561657
invoice: StaticInvoice,
1658+
/// The path to where invoice requests will be forwarded. If we receive an invoice
1659+
/// request, we'll forward it to the async recipient over this path in case the
1660+
/// recipient is online to provide a new invoice. This path should be persisted and
1661+
/// later provided to [`ChannelManager::respond_to_static_invoice_request`].
1662+
///
1663+
/// [`ChannelManager::respond_to_static_invoice_request`]: crate::ln::channelmanager::ChannelManager::respond_to_static_invoice_request
1664+
invoice_request_path: BlindedMessagePath,
16571665
/// Useful for the recipient to replace a specific invoice stored by us as the static invoice
16581666
/// server.
16591667
///
@@ -1686,12 +1694,14 @@ pub enum Event {
16861694
///
16871695
/// If we previously persisted a [`StaticInvoice`] from an [`Event::PersistStaticInvoice`] that
16881696
/// matches the below `recipient_id` and `invoice_slot`, that invoice should be retrieved now
1689-
/// and forwarded to the payer via [`ChannelManager::send_static_invoice`].
1697+
/// and forwarded to the payer via [`ChannelManager::respond_to_static_invoice_request`].
1698+
/// The invoice request path previously persisted from [`Event::PersistStaticInvoice`] should
1699+
/// also be provided in [`ChannelManager::respond_to_static_invoice_request`].
16901700
///
16911701
/// [`ChannelManager::blinded_paths_for_async_recipient`]: crate::ln::channelmanager::ChannelManager::blinded_paths_for_async_recipient
16921702
/// [`ChannelManager::set_paths_to_static_invoice_server`]: crate::ln::channelmanager::ChannelManager::set_paths_to_static_invoice_server
16931703
/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
1694-
/// [`ChannelManager::send_static_invoice`]: crate::ln::channelmanager::ChannelManager::send_static_invoice
1704+
/// [`ChannelManager::respond_to_static_invoice_request`]: crate::ln::channelmanager::ChannelManager::respond_to_static_invoice_request
16951705
StaticInvoiceRequested {
16961706
/// An identifier for the recipient previously surfaced in
16971707
/// [`Event::PersistStaticInvoice::recipient_id`]. Useful when paired with the `invoice_slot` to
@@ -1702,10 +1712,16 @@ pub enum Event {
17021712
/// retrieve the [`StaticInvoice`] requested by the payer.
17031713
invoice_slot: u16,
17041714
/// The path over which the [`StaticInvoice`] will be sent to the payer, which should be
1705-
/// provided to [`ChannelManager::send_static_invoice`] along with the invoice.
1715+
/// provided to [`ChannelManager::respond_to_static_invoice_request`] along with the invoice.
17061716
///
1707-
/// [`ChannelManager::send_static_invoice`]: crate::ln::channelmanager::ChannelManager::send_static_invoice
1717+
/// [`ChannelManager::respond_to_static_invoice_request`]: crate::ln::channelmanager::ChannelManager::respond_to_static_invoice_request
17081718
reply_path: Responder,
1719+
/// The invoice request that will be forwarded to the async recipient to give the
1720+
/// recipient a chance to provide an invoice in case it is online. It should be
1721+
/// provided to [`ChannelManager::respond_to_static_invoice_request`].
1722+
///
1723+
/// [`ChannelManager::respond_to_static_invoice_request`]: crate::ln::channelmanager::ChannelManager::respond_to_static_invoice_request
1724+
invoice_request: InvoiceRequest,
17091725
},
17101726
/// Indicates that a channel funding transaction constructed interactively is ready to be
17111727
/// signed. This event will only be triggered if at least one input was contributed.

0 commit comments

Comments
 (0)