@@ -1582,6 +1582,20 @@ impl FundingScope {
1582
1582
pub(crate) fn get_value_to_self_msat(&self) -> u64 {
1583
1583
self.value_to_self_msat
1584
1584
}
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
+ }
1585
1599
}
1586
1600
1587
1601
/// Contains everything about the channel including state, and various flags.
@@ -3177,21 +3191,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
3177
3191
pub fn get_counterparty_htlc_maximum_msat(&self, funding: &FundingScope) -> Option<u64> {
3178
3192
funding.get_htlc_maximum_msat(self.counterparty_max_htlc_value_in_flight_msat)
3179
3193
}
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
- }
3193
3194
3194
- impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
3195
3195
pub fn get_fee_proportional_millionths(&self) -> u32 {
3196
3196
self.config.options.forwarding_fee_proportional_millionths
3197
3197
}
@@ -3986,15 +3986,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
3986
3986
next_outbound_htlc_minimum_msat,
3987
3987
}
3988
3988
}
3989
- }
3990
3989
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 {
3998
3990
/// Get the commitment tx fee for the local's (i.e. our) next commitment transaction based on the
3999
3991
/// number of pending HTLCs that are on track to be in our next commitment tx.
4000
3992
///
0 commit comments