@@ -1603,6 +1603,20 @@ impl FundingScope {
1603
1603
pub(crate) fn get_value_to_self_msat(&self) -> u64 {
1604
1604
self.value_to_self_msat
1605
1605
}
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
+ }
1606
1620
}
1607
1621
1608
1622
/// Contains everything about the channel including state, and various flags.
@@ -3198,21 +3212,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
3198
3212
pub fn get_counterparty_htlc_maximum_msat(&self, funding: &FundingScope) -> Option<u64> {
3199
3213
funding.get_htlc_maximum_msat(self.counterparty_max_htlc_value_in_flight_msat)
3200
3214
}
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
- }
3214
3215
3215
- impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
3216
3216
pub fn get_fee_proportional_millionths(&self) -> u32 {
3217
3217
self.config.options.forwarding_fee_proportional_millionths
3218
3218
}
@@ -4007,15 +4007,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
4007
4007
next_outbound_htlc_minimum_msat,
4008
4008
}
4009
4009
}
4010
- }
4011
4010
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 {
4019
4011
/// Get the commitment tx fee for the local's (i.e. our) next commitment transaction based on the
4020
4012
/// number of pending HTLCs that are on track to be in our next commitment tx.
4021
4013
///
0 commit comments