Skip to content

Commit 6f6a8c1

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 ae3fdd9 commit 6f6a8c1

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
@@ -3705,13 +3705,9 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
37053705
} else {
37063706
log_trace!(logger, " ...not including inbound HTLC {} (hash {}) with value {} due to state ({})", htlc.htlc_id, &htlc.payment_hash, htlc.amount_msat, state_name);
37073707
match &htlc.state {
3708-
&InboundHTLCState::LocalRemoved(ref reason) => {
3709-
if generated_by_local {
3710-
if let &InboundHTLCRemovalReason::Fulfill(preimage) = reason {
3711-
inbound_htlc_preimages.push(preimage);
3712-
value_to_self_msat_offset += htlc.amount_msat as i64;
3713-
}
3714-
}
3708+
&InboundHTLCState::LocalRemoved(InboundHTLCRemovalReason::Fulfill(preimage)) => {
3709+
inbound_htlc_preimages.push(preimage);
3710+
value_to_self_msat_offset += htlc.amount_msat as i64;
37153711
},
37163712
_ => {},
37173713
}
@@ -3747,13 +3743,10 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
37473743
} else {
37483744
log_trace!(logger, " ...not including outbound HTLC {} (hash {}) with value {} due to state ({})", htlc.htlc_id, &htlc.payment_hash, htlc.amount_msat, state_name);
37493745
match htlc.state {
3750-
OutboundHTLCState::AwaitingRemoteRevokeToRemove(OutboundHTLCOutcome::Success(_))|OutboundHTLCState::AwaitingRemovedRemoteRevoke(OutboundHTLCOutcome::Success(_)) => {
3751-
value_to_self_msat_offset -= htlc.amount_msat as i64;
3752-
},
3746+
OutboundHTLCState::AwaitingRemoteRevokeToRemove(OutboundHTLCOutcome::Success(_)) |
3747+
OutboundHTLCState::AwaitingRemovedRemoteRevoke(OutboundHTLCOutcome::Success(_)) |
37533748
OutboundHTLCState::RemoteRemoved(OutboundHTLCOutcome::Success(_)) => {
3754-
if !generated_by_local {
3755-
value_to_self_msat_offset -= htlc.amount_msat as i64;
3756-
}
3749+
value_to_self_msat_offset -= htlc.amount_msat as i64;
37573750
},
37583751
_ => {},
37593752
}

0 commit comments

Comments
 (0)