Skip to content

Commit 3006844

Browse files
rustyrussellcdecker
authored andcommitted
lightningd: don't allow zero cltv HTLCs. (#2214)
Fixes: #2077 Fixes: #2213 Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
1 parent 0321d79 commit 3006844

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lightningd/peer_htlcs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ static bool check_amount(struct htlc_in *hin,
199199
static bool check_cltv(struct htlc_in *hin,
200200
u32 cltv_expiry, u32 outgoing_cltv_value, u32 delta)
201201
{
202-
if (cltv_expiry - delta >= outgoing_cltv_value)
202+
if (delta < cltv_expiry && cltv_expiry - delta >= outgoing_cltv_value)
203203
return true;
204204
log_debug(hin->key.channel->log, "HTLC %"PRIu64" incorrect CLTV:"
205205
" %u in, %u out, delta reqd %u",

0 commit comments

Comments
 (0)