Skip to content

Commit 072586e

Browse files
committed
Check for invoice expiry in InvoicePayer before we send any HTLCs
1 parent 11a5a7b commit 072586e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lightning-invoice/src/payment.rs

+4
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,10 @@ where
238238
final_value_msat: invoice.amount_milli_satoshis().or(amount_msats).unwrap(),
239239
final_cltv_expiry_delta: invoice.min_final_cltv_expiry() as u32,
240240
};
241+
if has_expired(params) {
242+
log_trace!(self.logger, "Invoice expired prior to first send for payment {}", log_bytes!(payment_hash.0));
243+
return Err(PaymentError::Invoice("Invoice expired prior to send"));
244+
}
241245
let first_hops = self.payer.first_hops();
242246
let route = self.router.find_route(
243247
&payer,

0 commit comments

Comments
 (0)