Skip to content

Commit 657b3a9

Browse files
committed
f: change timeout to relative expiry duration
1 parent 5bf4553 commit 657b3a9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lightning/src/ln/outbound_payment.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ use crate::sync::Mutex;
5555
pub(crate) const IDEMPOTENCY_TIMEOUT_TICKS: u8 = 7;
5656

5757
#[cfg(async_payments)]
58-
/// Relative expiration in seconds to wait for a pending outbound HTLC to a often-offline
58+
/// The default relative expiration to wait for a pending outbound HTLC to a often-offline
5959
/// payee to fulfill.
60-
const ASYNC_PAYMENT_TIMEOUT_SECS: u64 = 60 * 60 * 24 * 7;
60+
const ASYNC_PAYMENT_TIMEOUT_RELATIVE_EXPIRY: Duration = Duration::from_secs(60 * 60 * 24 * 7);
6161

6262
/// Stores the session_priv for each part of a payment that is still pending. For versions 0.0.102
6363
/// and later, also stores information for retrying the payment.
@@ -104,7 +104,7 @@ pub(crate) enum PendingOutboundPayment {
104104
invoice_request: InvoiceRequest,
105105
static_invoice: StaticInvoice,
106106
// Stale time expiration of how much time we will wait to the payment to fulfill.
107-
// Defaults to [`ASYNC_PAYMENT_TIMEOUT_SECS`].
107+
// Defaults to [`ASYNC_PAYMENT_TIMEOUT_RELATIVE_EXPIRY`].
108108
expiry_time: StaleExpiration,
109109
},
110110
Retryable {
@@ -1172,7 +1172,7 @@ impl OutboundPayments {
11721172
abandon_with_entry!(entry, PaymentFailureReason::RouteNotFound);
11731173
return Err(Bolt12PaymentError::SendingFailed(RetryableSendFailure::OnionPacketSizeExceeded))
11741174
}
1175-
let absolute_expiry = duration_since_epoch.saturating_add(Duration::from_secs(ASYNC_PAYMENT_TIMEOUT_SECS));
1175+
let absolute_expiry = duration_since_epoch.saturating_add(ASYNC_PAYMENT_TIMEOUT_RELATIVE_EXPIRY);
11761176

11771177
*entry.into_mut() = PendingOutboundPayment::StaticInvoiceReceived {
11781178
payment_hash,

0 commit comments

Comments
 (0)