@@ -2285,6 +2285,15 @@ const MAX_UNFUNDED_CHANNEL_PEERS: usize = 50;
2285
2285
/// many peers we reject new (inbound) connections.
2286
2286
const MAX_NO_CHANNEL_PEERS: usize = 250;
2287
2287
2288
+ /// The maximum expiration from the current time where an [`Offer`] or [`Refund`] is considered
2289
+ /// short-lived, while anything with a greater expiration is considered long-lived.
2290
+ ///
2291
+ /// Using [`ChannelManager::create_offer_builder`] or [`ChannelManager::create_refund_builder`],
2292
+ /// will included a [`BlindedPath`] created using:
2293
+ /// - [`MessageRouter::create_compact_blinded_paths`] when short-lived, and
2294
+ /// - [`MessageRouter::create_blinded_paths`] when long-lived.
2295
+ pub const MAX_SHORT_LIVED_RELATIVE_EXPIRY: Duration = Duration::from_secs(60 * 60 * 24);
2296
+
2288
2297
/// Information needed for constructing an invoice route hint for this channel.
2289
2298
#[derive(Clone, Debug, PartialEq)]
2290
2299
pub struct CounterpartyForwardingInfo {
@@ -8548,7 +8557,8 @@ macro_rules! create_offer_builder { ($self: ident, $builder: ty) => {
8548
8557
///
8549
8558
/// # Privacy
8550
8559
///
8551
- /// Uses [`MessageRouter`] to construct a [`BlindedPath`] for the offer. However, if one is not
8560
+ /// Uses [`MessageRouter`] to construct a [`BlindedPath`] for the offer based on the given
8561
+ /// `absolute_expiry` according to [`MAX_SHORT_LIVED_RELATIVE_EXPIRY`]. However, if one is not
8552
8562
/// found, uses a one-hop [`BlindedPath`] with [`ChannelManager::get_our_node_id`] as the
8553
8563
/// introduction node instead. In the latter case, the node must be announced, otherwise, there
8554
8564
/// is no way to find a path to the introduction in order to send the [`InvoiceRequest`].
@@ -8614,7 +8624,8 @@ macro_rules! create_refund_builder { ($self: ident, $builder: ty) => {
8614
8624
///
8615
8625
/// # Privacy
8616
8626
///
8617
- /// Uses [`MessageRouter`] to construct a [`BlindedPath`] for the refund. However, if one is not
8627
+ /// Uses [`MessageRouter`] to construct a [`BlindedPath`] for the refund based on the given
8628
+ /// `absolute_expiry` according to [`MAX_SHORT_LIVED_RELATIVE_EXPIRY`]. However, if one is not
8618
8629
/// found, uses a one-hop [`BlindedPath`] with [`ChannelManager::get_our_node_id`] as the
8619
8630
/// introduction node instead. In the latter case, the node must be announced, otherwise, there
8620
8631
/// is no way to find a path to the introduction in order to send the [`Bolt12Invoice`].
@@ -9000,12 +9011,11 @@ where
9000
9011
/// lifetime.
9001
9012
///
9002
9013
/// Whether or not the path is compact depends on whether the path is short-lived or long-lived,
9003
- /// respectively, based on the given `absolute_expiry` as seconds since the Unix epoch.
9014
+ /// respectively, based on the given `absolute_expiry` as seconds since the Unix epoch. See
9015
+ /// [`MAX_SHORT_LIVED_RELATIVE_EXPIRY`].
9004
9016
fn create_blinded_path_using_absolute_expiry(
9005
9017
&self, absolute_expiry: Option<Duration>
9006
9018
) -> Result<BlindedPath, ()> {
9007
- const MAX_SHORT_LIVED_RELATIVE_EXPIRY: Duration = Duration::from_secs(60 * 60 * 24);
9008
-
9009
9019
let now = self.duration_since_epoch();
9010
9020
let max_short_lived_absolute_expiry = now.saturating_add(MAX_SHORT_LIVED_RELATIVE_EXPIRY);
9011
9021
0 commit comments