From 5c7bfa7392fc49233bebb615650eff302fdc2404 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Viktor=20Tigerstr=C3=B6m?= <11711198+ViktorTigerstrom@users.noreply.github.com> Date: Fri, 22 Apr 2022 00:02:27 +0200 Subject: [PATCH] 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. --- lightning/src/ln/channel.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 ); } -- 2.39.5