Skip to content

Commit 61cb3a7

Browse files
committed
f clarify the height calculation criteria.
1 parent 1495024 commit 61cb3a7

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3061,6 +3061,10 @@ impl<ChanSigner: ChannelKeys, M: Deref + Sync + Send, T: Deref + Sync + Send, K:
30613061

30623062
channel_state.claimable_htlcs.retain(|&(ref payment_hash, _), htlcs| {
30633063
htlcs.retain(|htlc| {
3064+
// If height is approaching the number of blocks we think it takes us to get
3065+
// our commitment transaction confirmed before the HTLC expires, plus the
3066+
// number of blocks we generally consider it to take to do a commitment update,
3067+
// just give up on it and fail he HTLC.
30643068
if height >= htlc.cltv_expiry - CLTV_CLAIM_BUFFER - LATENCY_GRACE_PERIOD_BLOCKS {
30653069
timed_out_htlcs.push((HTLCSource::PreviousHopData(htlc.prev_hop.clone()), payment_hash.clone(), htlc.value));
30663070
false

0 commit comments

Comments
 (0)