From 3006844f926cd0a0fe2e98173745ee5ddb1498be Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 4 Jan 2019 00:08:35 +0000 Subject: [PATCH] lightningd: don't allow zero cltv HTLCs. (#2214) Fixes: #2077 Fixes: #2213 Signed-off-by: Rusty Russell --- lightningd/peer_htlcs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lightningd/peer_htlcs.c b/lightningd/peer_htlcs.c index 225e79b32..a69662ea0 100644 --- a/lightningd/peer_htlcs.c +++ b/lightningd/peer_htlcs.c @@ -199,7 +199,7 @@ static bool check_amount(struct htlc_in *hin, static bool check_cltv(struct htlc_in *hin, u32 cltv_expiry, u32 outgoing_cltv_value, u32 delta) { - if (cltv_expiry - delta >= outgoing_cltv_value) + if (delta < cltv_expiry && cltv_expiry - delta >= outgoing_cltv_value) return true; log_debug(hin->key.channel->log, "HTLC %"PRIu64" incorrect CLTV:" " %u in, %u out, delta reqd %u",