Skip to content

Commit 8dd3b30

Browse files
committed
f use a var for if we're done
1 parent 673eb60 commit 8dd3b30

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lightning/src/routing/scoring.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,14 +1143,15 @@ impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, T: Time> Score for Probabilis
11431143
.get(&hop.short_channel_id)
11441144
.and_then(|channel| channel.as_directed_to(&target));
11451145

1146-
if hop.short_channel_id == short_channel_id && hop_idx == 0 {
1146+
let at_failed_channel = hop.short_channel_id == short_channel_id;
1147+
if at_failed_channel && hop_idx == 0 {
11471148
log_warn!(self.logger, "Payment failed at the first hop - we do not attempt to learn channel info in such cases as we can directly observe local state.\n\tBecause we know the local state, we should generally not see failures here - this may be an indication that your channel peer on channel {} is broken and you may wish to close the channel.", hop.short_channel_id);
11481149
}
11491150

11501151
// Only score announced channels.
11511152
if let Some((channel, source)) = channel_directed_from_source {
11521153
let capacity_msat = channel.effective_capacity().as_msat();
1153-
if hop.short_channel_id == short_channel_id {
1154+
if at_failed_channel {
11541155
self.channel_liquidities
11551156
.entry(hop.short_channel_id)
11561157
.or_insert_with(ChannelLiquidity::new)
@@ -1167,7 +1168,7 @@ impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, T: Time> Score for Probabilis
11671168
log_debug!(self.logger, "Not able to penalize channel with SCID {} as we do not have graph info for it (likely a route-hint last-hop).",
11681169
hop.short_channel_id);
11691170
}
1170-
if hop.short_channel_id == short_channel_id { break; }
1171+
if at_failed_channel { break; }
11711172
}
11721173
}
11731174

0 commit comments

Comments
 (0)