@@ -1582,6 +1582,20 @@ impl FundingScope {
15821582 pub(crate) fn get_value_to_self_msat(&self) -> u64 {
15831583 self.value_to_self_msat
15841584 }
1585+
1586+ pub fn get_holder_counterparty_selected_channel_reserve_satoshis(&self) -> (u64, Option<u64>) {
1587+ (self.holder_selected_channel_reserve_satoshis, self.counterparty_selected_channel_reserve_satoshis)
1588+ }
1589+
1590+ fn get_htlc_maximum_msat(&self, party_max_htlc_value_in_flight_msat: u64) -> Option<u64> {
1591+ self.counterparty_selected_channel_reserve_satoshis.map(|counterparty_reserve| {
1592+ let holder_reserve = self.holder_selected_channel_reserve_satoshis;
1593+ cmp::min(
1594+ (self.channel_value_satoshis - counterparty_reserve - holder_reserve) * 1000,
1595+ party_max_htlc_value_in_flight_msat
1596+ )
1597+ })
1598+ }
15851599}
15861600
15871601/// Contains everything about the channel including state, and various flags.
@@ -3177,21 +3191,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
31773191 pub fn get_counterparty_htlc_maximum_msat(&self, funding: &FundingScope) -> Option<u64> {
31783192 funding.get_htlc_maximum_msat(self.counterparty_max_htlc_value_in_flight_msat)
31793193 }
3180- }
3181-
3182- impl FundingScope {
3183- fn get_htlc_maximum_msat(&self, party_max_htlc_value_in_flight_msat: u64) -> Option<u64> {
3184- self.counterparty_selected_channel_reserve_satoshis.map(|counterparty_reserve| {
3185- let holder_reserve = self.holder_selected_channel_reserve_satoshis;
3186- cmp::min(
3187- (self.channel_value_satoshis - counterparty_reserve - holder_reserve) * 1000,
3188- party_max_htlc_value_in_flight_msat
3189- )
3190- })
3191- }
3192- }
31933194
3194- impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
31953195 pub fn get_fee_proportional_millionths(&self) -> u32 {
31963196 self.config.options.forwarding_fee_proportional_millionths
31973197 }
@@ -3986,15 +3986,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
39863986 next_outbound_htlc_minimum_msat,
39873987 }
39883988 }
3989- }
39903989
3991- impl FundingScope {
3992- pub fn get_holder_counterparty_selected_channel_reserve_satoshis(&self) -> (u64, Option<u64>) {
3993- (self.holder_selected_channel_reserve_satoshis, self.counterparty_selected_channel_reserve_satoshis)
3994- }
3995- }
3996-
3997- impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
39983990 /// Get the commitment tx fee for the local's (i.e. our) next commitment transaction based on the
39993991 /// number of pending HTLCs that are on track to be in our next commitment tx.
40003992 ///
0 commit comments