lightningd: don't allow zero cltv HTLCs. (#2214)

Fixes: #2077
Fixes: #2213
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2019-01-04 00:08:35 +00:00 committed by Christian Decker
parent 0321d79540
commit 3006844f92
1 changed files with 1 additions and 1 deletions

View File

@ -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",