@@ -4191,30 +4191,32 @@ where
41914191 /// will *not* be present on the next commitment from `next_commitment_htlcs`, and
41924192 /// check if their outcome is successful. If it is, we add the value of this claimed
41934193 /// HTLC to the balance of the claimer.
4194- #[rustfmt::skip]
41954194 fn get_next_commitment_value_to_self_msat(&self, local: bool, funding: &FundingScope) -> u64 {
4196- let inbound_claimed_htlc_msat: u64 =
4197- self.pending_inbound_htlcs
4198- .iter()
4199- .filter(|InboundHTLCOutput { state, .. }| match (state, local) {
4200- (InboundHTLCState::LocalRemoved(InboundHTLCRemovalReason::Fulfill(_, _)), true) => false,
4201- (InboundHTLCState::LocalRemoved(InboundHTLCRemovalReason::Fulfill(_, _)), false) => true,
4202- _ => false,
4203- })
4204- .map(|InboundHTLCOutput { amount_msat, .. }| amount_msat)
4205- .sum();
4206- let outbound_claimed_htlc_msat: u64 =
4207- self.pending_outbound_htlcs
4208- .iter()
4209- .filter(|OutboundHTLCOutput { state, .. }| match (state, local) {
4210- (OutboundHTLCState::RemoteRemoved(OutboundHTLCOutcome::Success(_, _)), true) => true,
4211- (OutboundHTLCState::RemoteRemoved(OutboundHTLCOutcome::Success(_, _)), false) => false,
4212- (OutboundHTLCState::AwaitingRemoteRevokeToRemove(OutboundHTLCOutcome::Success(_, _)), _) => true,
4213- (OutboundHTLCState::AwaitingRemovedRemoteRevoke(OutboundHTLCOutcome::Success(_, _)), _) => true,
4214- _ => false,
4215- })
4216- .map(|OutboundHTLCOutput { amount_msat, .. }| amount_msat)
4217- .sum();
4195+ use InboundHTLCRemovalReason::Fulfill;
4196+ use OutboundHTLCOutcome::Success;
4197+
4198+ let inbound_claimed_htlc_msat: u64 = self
4199+ .pending_inbound_htlcs
4200+ .iter()
4201+ .filter(|InboundHTLCOutput { state, .. }| match (state, local) {
4202+ (InboundHTLCState::LocalRemoved(Fulfill(_, _)), true) => false,
4203+ (InboundHTLCState::LocalRemoved(Fulfill(_, _)), false) => true,
4204+ _ => false,
4205+ })
4206+ .map(|InboundHTLCOutput { amount_msat, .. }| amount_msat)
4207+ .sum();
4208+ let outbound_claimed_htlc_msat: u64 = self
4209+ .pending_outbound_htlcs
4210+ .iter()
4211+ .filter(|OutboundHTLCOutput { state, .. }| match (state, local) {
4212+ (OutboundHTLCState::RemoteRemoved(Success(_, _)), true) => true,
4213+ (OutboundHTLCState::RemoteRemoved(Success(_, _)), false) => false,
4214+ (OutboundHTLCState::AwaitingRemoteRevokeToRemove(Success(_, _)), _) => true,
4215+ (OutboundHTLCState::AwaitingRemovedRemoteRevoke(Success(_, _)), _) => true,
4216+ _ => false,
4217+ })
4218+ .map(|OutboundHTLCOutput { amount_msat, .. }| amount_msat)
4219+ .sum();
42184220
42194221 funding
42204222 .value_to_self_msat
0 commit comments