Skip to content

Commit 2853af2

Browse files
committed
Explicitly log a warning when a payment failed on the first hop
1 parent 6e26d8d commit 2853af2

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
@@ -847,12 +847,16 @@ impl<G: Deref<Target = NetworkGraph>, L: Deref, T: Time> Score for Probabilistic
847847
let liquidity_offset_half_life = self.params.liquidity_offset_half_life;
848848
log_trace!(self.logger, "Scoring path through to SCID {} as having failed at {} msat", short_channel_id, amount_msat);
849849
let network_graph = self.network_graph.read_only();
850-
for hop in path {
850+
for (hop_idx, hop) in path.iter().enumerate() {
851851
let target = NodeId::from_pubkey(&hop.pubkey);
852852
let channel_directed_from_source = network_graph.channels()
853853
.get(&hop.short_channel_id)
854854
.and_then(|channel| channel.as_directed_to(&target));
855855

856+
if hop.short_channel_id == short_channel_id && hop_idx == 0 {
857+
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);
858+
}
859+
856860
// Only score announced channels.
857861
if let Some((channel, source)) = channel_directed_from_source {
858862
let capacity_msat = channel.effective_capacity().as_msat();

0 commit comments

Comments
 (0)