Skip to content

Commit 30ab527

Browse files
committed
Clean up tautologies in ChannelContext::build_commitment_transaction
There is no need for an if statement if it will always be true.
1 parent 205dc20 commit 30ab527

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

lightning/src/ln/channel.rs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3681,13 +3681,9 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
36813681
} else {
36823682
log_trace!(logger, " ...not including inbound HTLC {} (hash {}) with value {} due to state ({})", htlc.htlc_id, &htlc.payment_hash, htlc.amount_msat, state_name);
36833683
match &htlc.state {
3684-
&InboundHTLCState::LocalRemoved(ref reason) => {
3685-
if generated_by_local {
3686-
if let &InboundHTLCRemovalReason::Fulfill(preimage) = reason {
3687-
inbound_htlc_preimages.push(preimage);
3688-
value_to_self_msat_offset += htlc.amount_msat as i64;
3689-
}
3690-
}
3684+
&InboundHTLCState::LocalRemoved(InboundHTLCRemovalReason::Fulfill(preimage)) => {
3685+
inbound_htlc_preimages.push(preimage);
3686+
value_to_self_msat_offset += htlc.amount_msat as i64;
36913687
},
36923688
_ => {},
36933689
}
@@ -3723,13 +3719,10 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
37233719
} else {
37243720
log_trace!(logger, " ...not including outbound HTLC {} (hash {}) with value {} due to state ({})", htlc.htlc_id, &htlc.payment_hash, htlc.amount_msat, state_name);
37253721
match htlc.state {
3726-
OutboundHTLCState::AwaitingRemoteRevokeToRemove(OutboundHTLCOutcome::Success(_))|OutboundHTLCState::AwaitingRemovedRemoteRevoke(OutboundHTLCOutcome::Success(_)) => {
3727-
value_to_self_msat_offset -= htlc.amount_msat as i64;
3728-
},
3722+
OutboundHTLCState::AwaitingRemoteRevokeToRemove(OutboundHTLCOutcome::Success(_)) |
3723+
OutboundHTLCState::AwaitingRemovedRemoteRevoke(OutboundHTLCOutcome::Success(_)) |
37293724
OutboundHTLCState::RemoteRemoved(OutboundHTLCOutcome::Success(_)) => {
3730-
if !generated_by_local {
3731-
value_to_self_msat_offset -= htlc.amount_msat as i64;
3732-
}
3725+
value_to_self_msat_offset -= htlc.amount_msat as i64;
37333726
},
37343727
_ => {},
37353728
}

0 commit comments

Comments
 (0)