Skip to content

Commit 78cbc38

Browse files
committed
Add a const and docs for the min min_final_cltv_expiry we allow
1 parent 9c82628 commit 78cbc38

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
@@ -583,6 +583,11 @@ pub(crate) const MAX_LOCAL_BREAKDOWN_TIMEOUT: u16 = 2 * 6 * 24 * 7;
583583
pub const MIN_CLTV_EXPIRY_DELTA: u16 = 6 * 6;
584584
pub(super) const CLTV_FAR_FAR_AWAY: u32 = 6 * 24 * 7; //TODO?
585585

586+
/// Minimum CLTV difference between the current block height and received inbound payments.
587+
/// Invoices generated for payment to us must set their `min_final_cltv_expiry` field to at least
588+
/// this value.
589+
pub const MIN_FINAL_CLTV_EXPIRY: u32 = HTLC_FAIL_BACK_BUFFER;
590+
586591
// Check that our CLTV_EXPIRY is at least CLTV_CLAIM_BUFFER + ANTI_REORG_DELAY + LATENCY_GRACE_PERIOD_BLOCKS,
587592
// ie that if the next-hop peer fails the HTLC within
588593
// LATENCY_GRACE_PERIOD_BLOCKS then we'll still have CLTV_CLAIM_BUFFER left to timeout it onchain,
@@ -3457,6 +3462,9 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
34573462
///
34583463
/// May panic if `invoice_expiry_delta_secs` is greater than one year.
34593464
///
3465+
/// Note that invoices generated for inbound payments should have their `min_final_cltv_expiry`
3466+
/// set to at least [`MIN_FINAL_CLTV_EXPIRY`].
3467+
///
34603468
/// [`create_inbound_payment`]: Self::create_inbound_payment
34613469
/// [`PaymentReceived`]: events::Event::PaymentReceived
34623470
/// [`PaymentReceived::user_payment_id`]: events::Event::PaymentReceived::user_payment_id

0 commit comments

Comments
 (0)