gossip: reject channel_update with invalid htlc_max_msat

If the channel update signals an invalid `htlc_maximum_msat` value,
we ignore the update.
This commit is contained in:
lisa neigut
2018-10-05 12:49:09 -07:00
committed by Rusty Russell
parent 1b6bd3fded
commit 762c795c9b

View File

@@ -1084,6 +1084,16 @@ bool routing_add_channel_update(struct routing_state *rstate,
if (!chan)
return false;
if (message_flags & ROUTING_OPT_HTLC_MAX_MSAT) {
/* Reject update if the `htlc_maximum_msat` is greater
* than the total available channel satoshis */
if (htlc_maximum_msat > chan->satoshis * 1000)
return false;
} else {
/* If not indicated, set htlc_max_msat to channel capacity */
htlc_maximum_msat = chan->satoshis * 1000;
}
direction = channel_flags & 0x1;
set_connection_values(chan, direction, fee_base_msat,
fee_proportional_millionths, expiry,