From: Viktor Tigerström <11711198+ViktorTigerstrom@users.noreply.github.com> Date: Thu, 21 Apr 2022 22:02:27 +0000 (+0200) Subject: Set `ChannelUpdate` `htlc_maximum_msat` using the peer's value X-Git-Tag: v0.0.107~44^2~1 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=5c7bfa7392fc49233bebb615650eff302fdc2404;p=rust-lightning Set `ChannelUpdate` `htlc_maximum_msat` using the peer's value Use the `counterparty_max_htlc_value_in_flight_msat` value, and not the `holder_max_htlc_value_in_flight_msat` value when creating the `htlc_maximum_msat` value for `ChannelUpdate` messages. BOLT 7 specifies that the field MUST be less than or equal to `max_htlc_value_in_flight_msat` received from the peer, which we currently are not guaranteed to adhere to by using the holder value. --- diff --git a/lightning/src/ln/channel.rs b/lightning/src/ln/channel.rs index 285bff61a..10f18cec3 100644 --- a/lightning/src/ln/channel.rs +++ b/lightning/src/ln/channel.rs @@ -4379,7 +4379,7 @@ impl Channel { // channel might have been used to route very small values (either by honest users or as DoS). self.channel_value_satoshis * 1000 * 9 / 10, - self.holder_max_htlc_value_in_flight_msat + self.counterparty_max_htlc_value_in_flight_msat ); }