Skip to content

Commit 41f8e1b

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 280c1a4 commit 41f8e1b

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
@@ -3709,13 +3709,9 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
37093709
} else {
37103710
log_trace!(logger, " ...not including inbound HTLC {} (hash {}) with value {} due to state ({})", htlc.htlc_id, &htlc.payment_hash, htlc.amount_msat, state_name);
37113711
match &htlc.state {
3712-
&InboundHTLCState::LocalRemoved(ref reason) => {
3713-
if generated_by_local {
3714-
if let &InboundHTLCRemovalReason::Fulfill(preimage) = reason {
3715-
inbound_htlc_preimages.push(preimage);
3716-
value_to_self_msat_offset += htlc.amount_msat as i64;
3717-
}
3718-
}
3712+
&InboundHTLCState::LocalRemoved(InboundHTLCRemovalReason::Fulfill(preimage)) => {
3713+
inbound_htlc_preimages.push(preimage);
3714+
value_to_self_msat_offset += htlc.amount_msat as i64;
37193715
},
37203716
_ => {},
37213717
}
@@ -3751,13 +3747,10 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
37513747
} else {
37523748
log_trace!(logger, " ...not including outbound HTLC {} (hash {}) with value {} due to state ({})", htlc.htlc_id, &htlc.payment_hash, htlc.amount_msat, state_name);
37533749
match htlc.state {
3754-
OutboundHTLCState::AwaitingRemoteRevokeToRemove(OutboundHTLCOutcome::Success(_))|OutboundHTLCState::AwaitingRemovedRemoteRevoke(OutboundHTLCOutcome::Success(_)) => {
3755-
value_to_self_msat_offset -= htlc.amount_msat as i64;
3756-
},
3750+
OutboundHTLCState::AwaitingRemoteRevokeToRemove(OutboundHTLCOutcome::Success(_)) |
3751+
OutboundHTLCState::AwaitingRemovedRemoteRevoke(OutboundHTLCOutcome::Success(_)) |
37573752
OutboundHTLCState::RemoteRemoved(OutboundHTLCOutcome::Success(_)) => {
3758-
if !generated_by_local {
3759-
value_to_self_msat_offset -= htlc.amount_msat as i64;
3760-
}
3753+
value_to_self_msat_offset -= htlc.amount_msat as i64;
37613754
},
37623755
_ => {},
37633756
}

0 commit comments

Comments
 (0)