Skip to content

Commit 6e298ff

Browse files
committed
Explicitly log a warning when a payment failed on the first hop
1 parent e6c702f commit 6e298ff

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lightning/src/routing/scoring.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -858,12 +858,16 @@ impl<G: Deref<Target = NetworkGraph>, L: Deref, T: Time> Score for Probabilistic
858858
let liquidity_offset_half_life = self.params.liquidity_offset_half_life;
859859
log_trace!(self.logger, "Scoring path through to SCID {} as having failed at {} msat", short_channel_id, amount_msat);
860860
let network_graph = self.network_graph.read_only();
861-
for hop in path {
861+
for (hop_idx, hop) in path.iter().enumerate() {
862862
let target = NodeId::from_pubkey(&hop.pubkey);
863863
let channel_directed_from_source = network_graph.channels()
864864
.get(&hop.short_channel_id)
865865
.and_then(|channel| channel.as_directed_to(&target));
866866

867+
if hop.short_channel_id == short_channel_id && hop_idx == 0 {
868+
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);
869+
}
870+
867871
// Only score announced channels.
868872
if let Some((channel, source)) = channel_directed_from_source {
869873
let capacity_msat = channel.effective_capacity().as_msat();

0 commit comments

Comments
 (0)