Skip to content

Commit ad21515

Browse files
Add config for paths to a static invoice server
As part of being an async recipient, we need to support interactively building an offer and static invoice with an always-online node that will serve static invoices on our behalf. Add a config field containing blinded message paths that async recipients can use to request blinded paths that will be included in their offer. Payers will forward invoice requests over the paths returned by the server, and receive a static invoice in response if the recipient is offline.
1 parent 7b62ea4 commit ad21515

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

lightning/src/util/config.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010
//! Various user-configurable channel limits and settings which ChannelManager
1111
//! applies for you.
1212
13+
use crate::blinded_path::message::BlindedMessagePath;
1314
use crate::ln::channel::MAX_FUNDING_SATOSHIS_NO_WUMBO;
1415
use crate::ln::channelmanager::{BREAKDOWN_TIMEOUT, MAX_LOCAL_BREAKDOWN_TIMEOUT};
16+
use crate::prelude::*;
1517

1618
#[cfg(fuzzing)]
1719
use crate::util::ser::Readable;
@@ -884,6 +886,14 @@ pub struct UserConfig {
884886
///
885887
/// Default value: `false`
886888
pub enable_dual_funded_channels: bool,
889+
/// [`BlindedMessagePath`]s to reach an always-online node that will serve [`StaticInvoice`]s on
890+
/// our behalf. Useful if we are an often-offline recipient that wants to receive async payments.
891+
/// Payers will send [`InvoiceRequest`]s over these paths, and receive a [`StaticInvoice`] in
892+
/// response from the always-online node.
893+
///
894+
/// [`StaticInvoice`]: crate::offers::static_invoice::StaticInvoice
895+
/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
896+
pub paths_to_static_invoice_server: Vec<BlindedMessagePath>,
887897
}
888898

889899
impl Default for UserConfig {
@@ -898,6 +908,7 @@ impl Default for UserConfig {
898908
accept_intercept_htlcs: false,
899909
manually_handle_bolt12_invoices: false,
900910
enable_dual_funded_channels: false,
911+
paths_to_static_invoice_server: Vec::new(),
901912
}
902913
}
903914
}
@@ -918,6 +929,7 @@ impl Readable for UserConfig {
918929
accept_intercept_htlcs: Readable::read(reader)?,
919930
manually_handle_bolt12_invoices: Readable::read(reader)?,
920931
enable_dual_funded_channels: Readable::read(reader)?,
932+
paths_to_static_invoice_server: Vec::new(),
921933
})
922934
}
923935
}

lightning/src/util/ser.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,6 +1080,7 @@ impl_for_vec!(crate::chain::channelmonitor::ChannelMonitorUpdate);
10801080
impl_for_vec!(crate::ln::channelmanager::MonitorUpdateCompletionAction);
10811081
impl_for_vec!(crate::ln::channelmanager::PaymentClaimDetails);
10821082
impl_for_vec!(crate::ln::msgs::SocketAddress);
1083+
impl_for_vec!(crate::blinded_path::message::BlindedMessagePath);
10831084
impl_for_vec!((A, B), A, B);
10841085
impl_for_vec!(SerialId);
10851086
impl_for_vec!(InteractiveTxInput);

0 commit comments

Comments
 (0)