Make our in-flight limit percentage configurable
authorViktor Tigerström <11711198+ViktorTigerstrom@users.noreply.github.com>
Tue, 26 Apr 2022 22:37:45 +0000 (00:37 +0200)
committerViktor Tigerström <11711198+ViktorTigerstrom@users.noreply.github.com>
Tue, 3 May 2022 20:35:43 +0000 (22:35 +0200)
commit0beaaa76dee796a367436518a734d7f4f3bd6f4b
tree5f3dd04a69844997c1dbbb69887bf428aec11bf2
parentdc8479a6202ea84489e51cba020a600f0a2b9695
Make our in-flight limit percentage configurable

Add a config field
`ChannelHandshakeConfig::max_inbound_htlc_value_in_flight_percent_of_channel`
which sets the percentage of the channel value we cap the total value of
outstanding inbound HTLCs to.

This field can be set to a value between 1-100, where the value
corresponds to the percent of the channel value in whole percentages.

Note that:
* If configured to another value than the default value 10, any new
channels created with the non default value will cause versions of LDK
prior to 0.0.104 to refuse to read the `ChannelManager`.

* This caps the total value for inbound HTLCs in-flight only, and
there's currently no way to configure the cap for the total value of
outbound HTLCs in-flight.

* The requirements for your node being online to ensure the safety of
HTLC-encumbered funds are different from the non-HTLC-encumbered funds.
This makes this an important knob to restrict exposure to loss due to
being offline for too long. See
`ChannelHandshakeConfig::our_to_self_delay` and
`ChannelConfig::cltv_expiry_delta` for more information.

Default value: 10.
Minimum value: 1, any values less than 1 will be treated as 1 instead.
Maximum value: 100, any values larger than 100 will be treated as 100
instead.
lightning/src/ln/channel.rs
lightning/src/util/config.rs