Skip to content

Commit 6d8aed8

Browse files
committed
f - remove extra impl blocks
1 parent c8d1598 commit 6d8aed8

File tree

1 file changed

+19
-28
lines changed

1 file changed

+19
-28
lines changed

lightning/src/ln/channel.rs

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,6 +1554,12 @@ pub(super) struct FundingScope {
15541554
channel_value_satoshis: u64,
15551555
}
15561556

1557+
impl FundingScope {
1558+
pub fn get_value_satoshis(&self) -> u64 {
1559+
self.channel_value_satoshis
1560+
}
1561+
}
1562+
15571563
/// Contains everything about the channel including state, and various flags.
15581564
pub(super) struct ChannelContext<SP: Deref> where SP::Target: SignerProvider {
15591565
config: LegacyChannelConfig,
@@ -3148,27 +3154,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
31483154
pub fn get_holder_htlc_maximum_msat(&self, funding: &FundingScope) -> Option<u64> {
31493155
self.get_htlc_maximum_msat(funding, self.holder_max_htlc_value_in_flight_msat)
31503156
}
3151-
}
3152-
3153-
impl<SP: Deref> FundedChannel<SP>
3154-
where
3155-
SP::Target: SignerProvider,
3156-
<SP::Target as SignerProvider>::EcdsaSigner: EcdsaChannelSigner,
3157-
{
3158-
/// Allowed in any state (including after shutdown)
3159-
pub fn get_announced_htlc_max_msat(&self) -> u64 {
3160-
return cmp::min(
3161-
// Upper bound by capacity. We make it a bit less than full capacity to prevent attempts
3162-
// to use full capacity. This is an effort to reduce routing failures, because in many cases
3163-
// channel might have been used to route very small values (either by honest users or as DoS).
3164-
self.funding.channel_value_satoshis * 1000 * 9 / 10,
3165-
3166-
self.context.counterparty_max_htlc_value_in_flight_msat
3167-
);
3168-
}
3169-
}
31703157

3171-
impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
31723158
/// Allowed in any state (including after shutdown)
31733159
pub fn get_counterparty_htlc_minimum_msat(&self) -> u64 {
31743160
self.counterparty_htlc_minimum_msat
@@ -3188,15 +3174,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
31883174
)
31893175
})
31903176
}
3191-
}
31923177

3193-
impl FundingScope {
3194-
pub fn get_value_satoshis(&self) -> u64 {
3195-
self.channel_value_satoshis
3196-
}
3197-
}
3198-
3199-
impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
32003178
pub fn get_fee_proportional_millionths(&self) -> u32 {
32013179
self.config.options.forwarding_fee_proportional_millionths
32023180
}
@@ -8573,6 +8551,8 @@ impl<SP: Deref> FundedChannel<SP> where
85738551
Ok((shutdown, monitor_update, dropped_outbound_htlcs))
85748552
}
85758553

8554+
// Miscellaneous utilities
8555+
85768556
pub fn inflight_htlc_sources(&self) -> impl Iterator<Item=(&HTLCSource, &PaymentHash)> {
85778557
self.context.holding_cell_htlc_updates.iter()
85788558
.flat_map(|htlc_update| {
@@ -8584,6 +8564,17 @@ impl<SP: Deref> FundedChannel<SP> where
85848564
})
85858565
.chain(self.context.pending_outbound_htlcs.iter().map(|htlc| (&htlc.source, &htlc.payment_hash)))
85868566
}
8567+
8568+
pub fn get_announced_htlc_max_msat(&self) -> u64 {
8569+
return cmp::min(
8570+
// Upper bound by capacity. We make it a bit less than full capacity to prevent attempts
8571+
// to use full capacity. This is an effort to reduce routing failures, because in many cases
8572+
// channel might have been used to route very small values (either by honest users or as DoS).
8573+
self.funding.channel_value_satoshis * 1000 * 9 / 10,
8574+
8575+
self.context.counterparty_max_htlc_value_in_flight_msat
8576+
);
8577+
}
85878578
}
85888579

85898580
/// A not-yet-funded outbound (from holder) channel using V1 channel establishment.

0 commit comments

Comments
 (0)