Skip to content

Commit e4e9fd7

Browse files
committed
f - use absolute expiry in add_new_awaiting_invoice
1 parent de24181 commit e4e9fd7

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7213,9 +7213,23 @@ where
72137213
let invoice_request = builder.build_and_sign()?;
72147214
let reply_path = self.create_one_hop_blinded_path();
72157215

7216+
#[cfg(feature = "std")]
7217+
let duration_since_epoch = std::time::SystemTime::now()
7218+
.duration_since(std::time::SystemTime::UNIX_EPOCH)
7219+
.expect("SystemTime::now() should come after SystemTime::UNIX_EPOCH");
7220+
#[cfg(not(feature = "std"))]
7221+
let duration_since_epoch = Duration::from_secs(
7222+
self.highest_seen_timestamp.load(Ordering::Acquire) as u64
7223+
);
7224+
7225+
const INVOICE_REQUEST_RELATIVE_EXPIRY: Duration = Duration::from_secs(3 * 60);
7226+
let absolute_expiry = duration_since_epoch
7227+
.checked_add(INVOICE_REQUEST_RELATIVE_EXPIRY)
7228+
.unwrap_or(Duration::from_secs(u64::MAX));
7229+
72167230
self.pending_outbound_payments
7217-
.add_new_awaiting_invoice_for_offer(
7218-
payment_id, retry_strategy, max_total_routing_fee_msat
7231+
.add_new_awaiting_invoice(
7232+
payment_id, absolute_expiry, retry_strategy, max_total_routing_fee_msat
72197233
)
72207234
.map_err(|_| Bolt12SemanticError::DuplicatePaymentId)?;
72217235

0 commit comments

Comments
 (0)