Set `ChannelUpdate` `htlc_maximum_msat` using the peer's value
authorViktor Tigerström <11711198+ViktorTigerstrom@users.noreply.github.com>
Thu, 21 Apr 2022 22:02:27 +0000 (00:02 +0200)
committerViktor Tigerström <11711198+ViktorTigerstrom@users.noreply.github.com>
Tue, 3 May 2022 20:42:37 +0000 (22:42 +0200)
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

index 285bff61acd26e0390400a8e1e430277a0d5f6a1..10f18cec32d456d16b5ab2e7867ffadfb3ba5125 100644 (file)
@@ -4379,7 +4379,7 @@ impl<Signer: Sign> Channel<Signer> {
                        // 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
                );
        }