@@ -1575,6 +1575,12 @@ pub(super) struct FundingScope {
1575
1575
channel_value_satoshis: u64,
1576
1576
}
1577
1577
1578
+ impl FundingScope {
1579
+ pub fn get_value_satoshis(&self) -> u64 {
1580
+ self.channel_value_satoshis
1581
+ }
1582
+ }
1583
+
1578
1584
/// Contains everything about the channel including state, and various flags.
1579
1585
pub(super) struct ChannelContext<SP: Deref> where SP::Target: SignerProvider {
1580
1586
config: LegacyChannelConfig,
@@ -3169,27 +3175,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
3169
3175
pub fn get_holder_htlc_maximum_msat(&self, funding: &FundingScope) -> Option<u64> {
3170
3176
self.get_htlc_maximum_msat(funding, self.holder_max_htlc_value_in_flight_msat)
3171
3177
}
3172
- }
3173
-
3174
- impl<SP: Deref> FundedChannel<SP>
3175
- where
3176
- SP::Target: SignerProvider,
3177
- <SP::Target as SignerProvider>::EcdsaSigner: EcdsaChannelSigner,
3178
- {
3179
- /// Allowed in any state (including after shutdown)
3180
- pub fn get_announced_htlc_max_msat(&self) -> u64 {
3181
- return cmp::min(
3182
- // Upper bound by capacity. We make it a bit less than full capacity to prevent attempts
3183
- // to use full capacity. This is an effort to reduce routing failures, because in many cases
3184
- // channel might have been used to route very small values (either by honest users or as DoS).
3185
- self.funding.channel_value_satoshis * 1000 * 9 / 10,
3186
-
3187
- self.context.counterparty_max_htlc_value_in_flight_msat
3188
- );
3189
- }
3190
- }
3191
3178
3192
- impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
3193
3179
/// Allowed in any state (including after shutdown)
3194
3180
pub fn get_counterparty_htlc_minimum_msat(&self) -> u64 {
3195
3181
self.counterparty_htlc_minimum_msat
@@ -3209,15 +3195,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
3209
3195
)
3210
3196
})
3211
3197
}
3212
- }
3213
3198
3214
- impl FundingScope {
3215
- pub fn get_value_satoshis(&self) -> u64 {
3216
- self.channel_value_satoshis
3217
- }
3218
- }
3219
-
3220
- impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
3221
3199
pub fn get_fee_proportional_millionths(&self) -> u32 {
3222
3200
self.config.options.forwarding_fee_proportional_millionths
3223
3201
}
@@ -8607,6 +8585,8 @@ impl<SP: Deref> FundedChannel<SP> where
8607
8585
Ok((shutdown, monitor_update, dropped_outbound_htlcs))
8608
8586
}
8609
8587
8588
+ // Miscellaneous utilities
8589
+
8610
8590
pub fn inflight_htlc_sources(&self) -> impl Iterator<Item=(&HTLCSource, &PaymentHash)> {
8611
8591
self.context.holding_cell_htlc_updates.iter()
8612
8592
.flat_map(|htlc_update| {
@@ -8618,6 +8598,17 @@ impl<SP: Deref> FundedChannel<SP> where
8618
8598
})
8619
8599
.chain(self.context.pending_outbound_htlcs.iter().map(|htlc| (&htlc.source, &htlc.payment_hash)))
8620
8600
}
8601
+
8602
+ pub fn get_announced_htlc_max_msat(&self) -> u64 {
8603
+ return cmp::min(
8604
+ // Upper bound by capacity. We make it a bit less than full capacity to prevent attempts
8605
+ // to use full capacity. This is an effort to reduce routing failures, because in many cases
8606
+ // channel might have been used to route very small values (either by honest users or as DoS).
8607
+ self.funding.channel_value_satoshis * 1000 * 9 / 10,
8608
+
8609
+ self.context.counterparty_max_htlc_value_in_flight_msat
8610
+ );
8611
+ }
8621
8612
}
8622
8613
8623
8614
/// A not-yet-funded outbound (from holder) channel using V1 channel establishment.
0 commit comments