@@ -2285,6 +2285,15 @@ const MAX_UNFUNDED_CHANNEL_PEERS: usize = 50;
22852285/// many peers we reject new (inbound) connections.
22862286const MAX_NO_CHANNEL_PEERS: usize = 250;
22872287
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+
22882297/// Information needed for constructing an invoice route hint for this channel.
22892298#[derive(Clone, Debug, PartialEq)]
22902299pub struct CounterpartyForwardingInfo {
@@ -8548,7 +8557,8 @@ macro_rules! create_offer_builder { ($self: ident, $builder: ty) => {
85488557 ///
85498558 /// # Privacy
85508559 ///
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
85528562 /// found, uses a one-hop [`BlindedPath`] with [`ChannelManager::get_our_node_id`] as the
85538563 /// introduction node instead. In the latter case, the node must be announced, otherwise, there
85548564 /// 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) => {
86148624 ///
86158625 /// # Privacy
86168626 ///
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
86188629 /// found, uses a one-hop [`BlindedPath`] with [`ChannelManager::get_our_node_id`] as the
86198630 /// introduction node instead. In the latter case, the node must be announced, otherwise, there
86208631 /// is no way to find a path to the introduction in order to send the [`Bolt12Invoice`].
@@ -9000,12 +9011,11 @@ where
90009011 /// lifetime.
90019012 ///
90029013 /// 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`].
90049016 fn create_blinded_path_using_absolute_expiry(
90059017 &self, absolute_expiry: Option<Duration>
90069018 ) -> Result<BlindedPath, ()> {
9007- const MAX_SHORT_LIVED_RELATIVE_EXPIRY: Duration = Duration::from_secs(60 * 60 * 24);
9008-
90099019 let now = self.duration_since_epoch();
90109020 let max_short_lived_absolute_expiry = now.saturating_add(MAX_SHORT_LIVED_RELATIVE_EXPIRY);
90119021
0 commit comments