@@ -1603,6 +1603,20 @@ impl FundingScope {
16031603 pub(crate) fn get_value_to_self_msat(&self) -> u64 {
16041604 self.value_to_self_msat
16051605 }
1606+
1607+ pub fn get_holder_counterparty_selected_channel_reserve_satoshis(&self) -> (u64, Option<u64>) {
1608+ (self.holder_selected_channel_reserve_satoshis, self.counterparty_selected_channel_reserve_satoshis)
1609+ }
1610+
1611+ fn get_htlc_maximum_msat(&self, party_max_htlc_value_in_flight_msat: u64) -> Option<u64> {
1612+ self.counterparty_selected_channel_reserve_satoshis.map(|counterparty_reserve| {
1613+ let holder_reserve = self.holder_selected_channel_reserve_satoshis;
1614+ cmp::min(
1615+ (self.channel_value_satoshis - counterparty_reserve - holder_reserve) * 1000,
1616+ party_max_htlc_value_in_flight_msat
1617+ )
1618+ })
1619+ }
16061620}
16071621
16081622/// Contains everything about the channel including state, and various flags.
@@ -3198,21 +3212,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
31983212 pub fn get_counterparty_htlc_maximum_msat(&self, funding: &FundingScope) -> Option<u64> {
31993213 funding.get_htlc_maximum_msat(self.counterparty_max_htlc_value_in_flight_msat)
32003214 }
3201- }
3202-
3203- impl FundingScope {
3204- fn get_htlc_maximum_msat(&self, party_max_htlc_value_in_flight_msat: u64) -> Option<u64> {
3205- self.counterparty_selected_channel_reserve_satoshis.map(|counterparty_reserve| {
3206- let holder_reserve = self.holder_selected_channel_reserve_satoshis;
3207- cmp::min(
3208- (self.channel_value_satoshis - counterparty_reserve - holder_reserve) * 1000,
3209- party_max_htlc_value_in_flight_msat
3210- )
3211- })
3212- }
3213- }
32143215
3215- impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
32163216 pub fn get_fee_proportional_millionths(&self) -> u32 {
32173217 self.config.options.forwarding_fee_proportional_millionths
32183218 }
@@ -4007,15 +4007,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
40074007 next_outbound_htlc_minimum_msat,
40084008 }
40094009 }
4010- }
40114010
4012- impl FundingScope {
4013- pub fn get_holder_counterparty_selected_channel_reserve_satoshis(&self) -> (u64, Option<u64>) {
4014- (self.holder_selected_channel_reserve_satoshis, self.counterparty_selected_channel_reserve_satoshis)
4015- }
4016- }
4017-
4018- impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
40194011 /// Get the commitment tx fee for the local's (i.e. our) next commitment transaction based on the
40204012 /// number of pending HTLCs that are on track to be in our next commitment tx.
40214013 ///
0 commit comments