Skip to content

Commit 43a197d

Browse files
author
Antoine Riard
committed
Document exactly our CLTV sanitization policy for incoming HTLCs
1 parent a4e4056 commit 43a197d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1098,7 +1098,8 @@ impl<ChanSigner: ChannelKeys, M: Deref, T: Deref, K: Deref, F: Deref> ChannelMan
10981098
break Some(("Forwarding node has tampered with the intended HTLC values or origin node has an obsolete cltv_expiry_delta", 0x1000 | 13, Some(self.get_channel_update(chan).unwrap())));
10991099
}
11001100
let cur_height = self.latest_block_height.load(Ordering::Acquire) as u32 + 1;
1101-
// We want to have at least LATENCY_GRACE_PERIOD_BLOCKS to fail prior to going on chain CLAIM_BUFFER blocks before expiration
1101+
// Theoritically, channel counterparty shouldn't send us a HLC expiring now, but we want to be robust wrt to counterparty
1102+
// packet sanitization.
11021103
if msg.cltv_expiry <= cur_height + CLTV_CLAIM_BUFFER + LATENCY_GRACE_PERIOD_BLOCKS as u32 { // expiry_too_soon
11031104
break Some(("CLTV expiry is too close", 0x1000 | 14, Some(self.get_channel_update(chan).unwrap())));
11041105
}

0 commit comments

Comments
 (0)