@@ -746,8 +746,10 @@ pub const COMMITMENT_TX_WEIGHT_PER_HTLC: u64 = 172;
746
746
pub const ANCHOR_OUTPUT_VALUE_SATOSHI : u64 = 330 ;
747
747
748
748
/// The percentage of the channel value `holder_max_htlc_value_in_flight_msat` used to be set to,
749
- /// before this was made configurable.
750
- pub const OLD_LDK_MAX_IN_FLIGHT_PERCENT : u8 = 10 ;
749
+ /// before this was made configurable. The percentage was made configurable in LDK 0.0.107,
750
+ /// although LDK 0.0.104+ enabled serialization of channels with a different value set for
751
+ /// `holder_max_htlc_value_in_flight_msat`.
752
+ pub const MAX_IN_FLIGHT_PERCENT_LEGACY : u8 = 10 ;
751
753
752
754
/// Maximum `funding_satoshis` value according to the BOLT #2 specification, if
753
755
/// `option_support_large_channel` (aka wumbo channels) is not supported.
@@ -808,13 +810,12 @@ macro_rules! secp_check {
808
810
809
811
impl < Signer : Sign > Channel < Signer > {
810
812
/// Returns the value to use for `holder_max_htlc_value_in_flight_msat` as a percentage of the
811
- /// `channel_value_satoshis` in msat, based on how many of the percent its been configured to
812
- /// be set to by the user.
813
+ /// `channel_value_satoshis` in msat, set through
814
+ /// [`ChannelHandshakeConfig::max_inbound_htlc_value_in_flight_percent_of_channel`]
813
815
///
814
- /// As we only allow the user to set the percentage to a value between `1-100`, if the user
815
- /// sets a value less than `1`, the function will result in `1` percent of the
816
- /// `channel_value_satoshis`, as well as `100` percent if the user has set a value larger
817
- /// than `100`.
816
+ /// The effective percentage is lower bounded by 1% and upper bounded by 100%.
817
+ ///
818
+ /// [`ChannelHandshakeConfig::max_inbound_htlc_value_in_flight_percent_of_channel`]: crate::util::config::ChannelHandshakeConfig::max_inbound_htlc_value_in_flight_percent_of_channel
818
819
fn get_holder_max_htlc_value_in_flight_msat ( channel_value_satoshis : u64 , config : & ChannelHandshakeConfig ) -> u64 {
819
820
let configured_percent = if config. max_inbound_htlc_value_in_flight_percent_of_channel < 1 {
820
821
1
@@ -5904,7 +5905,7 @@ impl<Signer: Sign> Writeable for Channel<Signer> {
5904
5905
{ Some ( self . holder_selected_channel_reserve_satoshis ) } else { None } ;
5905
5906
5906
5907
let mut old_max_in_flight_percent_config = UserConfig :: default ( ) . own_channel_config ;
5907
- old_max_in_flight_percent_config. max_inbound_htlc_value_in_flight_percent_of_channel = OLD_LDK_MAX_IN_FLIGHT_PERCENT ;
5908
+ old_max_in_flight_percent_config. max_inbound_htlc_value_in_flight_percent_of_channel = MAX_IN_FLIGHT_PERCENT_LEGACY ;
5908
5909
let serialized_holder_htlc_max_in_flight =
5909
5910
if self . holder_max_htlc_value_in_flight_msat != Self :: get_holder_max_htlc_value_in_flight_msat ( self . channel_value_satoshis , & old_max_in_flight_percent_config)
5910
5911
{ Some ( self . holder_max_htlc_value_in_flight_msat ) } else { None } ;
0 commit comments