is_usable: true, is_public: true,
balance_msat: 0,
outbound_capacity_msat: 0,
+ inbound_htlc_minimum_msat: None,
+ inbound_htlc_maximum_msat: None,
});
}
Some(&first_hops_vec[..])
}
/// Allowed in any state (including after shutdown)
- #[cfg(test)]
pub fn get_holder_htlc_minimum_msat(&self) -> u64 {
self.holder_htlc_minimum_msat
}
+ /// Allowed in any state (including after shutdown), but will return none before TheirInitSent
+ pub fn get_holder_htlc_maximum_msat(&self) -> Option<u64> {
+ self.get_htlc_maximum_msat(self.holder_max_htlc_value_in_flight_msat)
+ }
+
/// Allowed in any state (including after shutdown)
pub fn get_announced_htlc_max_msat(&self) -> u64 {
return cmp::min(
self.counterparty_htlc_minimum_msat
}
+ fn get_htlc_maximum_msat(&self, party_max_htlc_value_in_flight_msat: u64) -> Option<u64> {
+ self.counterparty_selected_channel_reserve_satoshis.map(|counterparty_reserve| {
+ let holder_reserve = self.holder_selected_channel_reserve_satoshis;
+ cmp::min(
+ (self.channel_value_satoshis - counterparty_reserve - holder_reserve) * 1000,
+ party_max_htlc_value_in_flight_msat
+ )
+ })
+ }
+
pub fn get_value_satoshis(&self) -> u64 {
self.channel_value_satoshis
}
pub is_usable: bool,
/// True if this channel is (or will be) publicly-announced.
pub is_public: bool,
+ /// The smallest value HTLC (in msat) we will accept, for this channel. This field
+ /// is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107
+ pub inbound_htlc_minimum_msat: Option<u64>,
+ /// The largest value HTLC (in msat) we currently will accept, for this channel.
+ pub inbound_htlc_maximum_msat: Option<u64>,
}
impl ChannelDetails {
is_funding_locked: channel.is_usable(),
is_usable: channel.is_live(),
is_public: channel.should_announce(),
+ inbound_htlc_minimum_msat: Some(channel.get_holder_htlc_minimum_msat()),
+ inbound_htlc_maximum_msat: channel.get_holder_htlc_maximum_msat()
});
}
}
(28, is_funding_locked, required),
(30, is_usable, required),
(32, is_public, required),
+ (33, inbound_htlc_minimum_msat, option),
+ (35, inbound_htlc_maximum_msat, option),
});
impl_writeable_tlv_based!(PhantomRouteHints, {
force_close_spend_delay: None,
is_outbound: true, is_funding_locked: true,
is_usable: true, is_public: true,
+ inbound_htlc_minimum_msat: None,
+ inbound_htlc_maximum_msat: None,
}
}
is_funding_locked: true,
is_usable: true,
is_public: true,
+ inbound_htlc_minimum_msat: None,
+ inbound_htlc_maximum_msat: None,
}
}