Skip to content

Commit 7f320f5

Browse files
committed
Add a const and docs for the min min_final_cltv_expiry we allow
1 parent f35048c commit 7f320f5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,11 @@ pub(crate) const MAX_LOCAL_BREAKDOWN_TIMEOUT: u16 = 2 * 6 * 24 * 7;
588588
pub const MIN_CLTV_EXPIRY_DELTA: u16 = 6 * 6;
589589
pub(super) const CLTV_FAR_FAR_AWAY: u32 = 6 * 24 * 7; //TODO?
590590

591+
/// Minimum CLTV difference between the current block height and received inbound payments.
592+
/// Invoices generated for payment to us must set their `min_final_cltv_expiry` field to at least
593+
/// this value.
594+
pub const MIN_FINAL_CLTV_EXPIRY: u32 = HTLC_FAIL_BACK_BUFFER;
595+
591596
// Check that our CLTV_EXPIRY is at least CLTV_CLAIM_BUFFER + ANTI_REORG_DELAY + LATENCY_GRACE_PERIOD_BLOCKS,
592597
// ie that if the next-hop peer fails the HTLC within
593598
// LATENCY_GRACE_PERIOD_BLOCKS then we'll still have CLTV_CLAIM_BUFFER left to timeout it onchain,
@@ -3461,6 +3466,9 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
34613466
///
34623467
/// May panic if `invoice_expiry_delta_secs` is greater than one year.
34633468
///
3469+
/// Note that invoices generated for inbound payments should have their `min_final_cltv_expiry`
3470+
/// set to at least [`MIN_FINAL_CLTV_EXPIRY`].
3471+
///
34643472
/// [`create_inbound_payment`]: Self::create_inbound_payment
34653473
/// [`PaymentReceived`]: events::Event::PaymentReceived
34663474
/// [`PaymentReceived::user_payment_id`]: events::Event::PaymentReceived::user_payment_id

0 commit comments

Comments
 (0)