Run fmt on `get_next_commitment_value_to_self_msat`
What changed, and why it matters
This commit is purely a formatting cleanup. It removes a `#[rustfmt::skip]` annotation and lets rustfmt reformat a single function. The code logic is unchanged; only whitespace, line breaks, and two local `use` imports were added to make the function easier to read.
No security action needed. This is a cosmetic formatting change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff removes #[rustfmt::skip] from get_next_commitment_value_to_self_msat in lightning/src/ln/channel.rs and reformats the function. It also introduces two local use aliases (InboundHTLCRemovalReason::Fulfill and OutboundHTLCOutcome::Success) to shorten match arms. No functional changes are present; the filter/map/sum logic and all pattern matches remain identical.
Changed components
lightning/src/ln/channel.rsInspect captured patch +25 / −23
diff --git a/lightning/src/ln/channel.rs b/lightning/src/ln/channel.rs
index 40215ba..5abaf53 100644
--- a/lightning/src/ln/channel.rs
+++ b/lightning/src/ln/channel.rs
@@ -4191,30 +4191,32 @@ where
/// will *not* be present on the next commitment from `next_commitment_htlcs`, and
/// check if their outcome is successful. If it is, we add the value of this claimed
/// HTLC to the balance of the claimer.
- #[rustfmt::skip]
fn get_next_commitment_value_to_self_msat(&self, local: bool, funding: &FundingScope) -> u64 {
- let inbound_claimed_htlc_msat: u64 =
- self.pending_inbound_htlcs
- .iter()
- .filter(|InboundHTLCOutput { state, .. }| match (state, local) {
- (InboundHTLCState::LocalRemoved(InboundHTLCRemovalReason::Fulfill(_, _)), true) => false,
- (InboundHTLCState::LocalRemoved(InboundHTLCRemovalReason::Fulfill(_, _)), false) => true,
- _ => false,
- })
- .map(|InboundHTLCOutput { amount_msat, .. }| amount_msat)
- .sum();
- let outbound_claimed_htlc_msat: u64 =
- self.pending_outbound_htlcs
- .iter()
- .filter(|OutboundHTLCOutput { state, .. }| match (state, local) {
- (OutboundHTLCState::RemoteRemoved(OutboundHTLCOutcome::Success(_, _)), true) => true,
- (OutboundHTLCState::RemoteRemoved(OutboundHTLCOutcome::Success(_, _)), false) => false,
- (OutboundHTLCState::AwaitingRemoteRevokeToRemove(OutboundHTLCOutcome::Success(_, _)), _) => true,
- (OutboundHTLCState::AwaitingRemovedRemoteRevoke(OutboundHTLCOutcome::Success(_, _)), _) => true,
- _ => false,
- })
- .map(|OutboundHTLCOutput { amount_msat, .. }| amount_msat)
- .sum();
+ use InboundHTLCRemovalReason::Fulfill;
+ use OutboundHTLCOutcome::Success;
+
+ let inbound_claimed_htlc_msat: u64 = self
+ .pending_inbound_htlcs
+ .iter()
+ .filter(|InboundHTLCOutput { state, .. }| match (state, local) {
+ (InboundHTLCState::LocalRemoved(Fulfill(_, _)), true) => false,
+ (InboundHTLCState::LocalRemoved(Fulfill(_, _)), false) => true,
+ _ => false,
+ })
+ .map(|InboundHTLCOutput { amount_msat, .. }| amount_msat)
+ .sum();
+ let outbound_claimed_htlc_msat: u64 = self
+ .pending_outbound_htlcs
+ .iter()
+ .filter(|OutboundHTLCOutput { state, .. }| match (state, local) {
+ (OutboundHTLCState::RemoteRemoved(Success(_, _)), true) => true,
+ (OutboundHTLCState::RemoteRemoved(Success(_, _)), false) => false,
+ (OutboundHTLCState::AwaitingRemoteRevokeToRemove(Success(_, _)), _) => true,
+ (OutboundHTLCState::AwaitingRemovedRemoteRevoke(Success(_, _)), _) => true,
+ _ => false,
+ })
+ .map(|OutboundHTLCOutput { amount_msat, .. }| amount_msat)
+ .sum();
funding
.value_to_self_msat
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.