lightningd: check for excessive HTLC locktimes.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2017-10-23 14:46:57 +10:30 committed by Christian Decker
parent 0000dc5908
commit c2a0c51c30
1 changed files with 13 additions and 0 deletions

View File

@ -545,6 +545,19 @@ static void forward_htlc(struct htlc_in *hin,
goto fail;
}
/* FIXME: Add this to BOLT! */
if (get_block_height(next->ld->topology)
+ next->ld->config.max_htlc_expiry < outgoing_cltv_value) {
log_debug(hin->key.peer->log,
"Expiry cltv %u too far from current %u + max %u",
outgoing_cltv_value,
get_block_height(next->ld->topology),
next->ld->config.max_htlc_expiry);
/* FIXME: WIRE_EXPIRY_TOO_FAR? */
failcode = WIRE_TEMPORARY_CHANNEL_FAILURE;
goto fail;
}
failcode = send_htlc_out(next, amt_to_forward,
outgoing_cltv_value, &hin->payment_hash,
next_onion, hin, NULL, NULL);