mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 21:35:11 +01:00
lightningd: check for excessive HTLC locktimes.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
0000dc5908
commit
c2a0c51c30
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user