Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions lightning/src/routing/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3637,6 +3637,9 @@ pub(crate) fn get_route<L: Logger, S: ScoreLookUp>(

// Step (5).
if payment_paths.len() == 0 {
if matches!(payment_params.payee, Payee::Blinded { .. }) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh? #4308 has nothing to do with blinded paths but rather with when we've tried every last-hop. Also this is the wrong check - at this point in the code we simply failed to find a path, you can't say anything about why.

Copy link
Contributor Author

@okekefrancis112 okekefrancis112 Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh? #4308 has nothing to do with blinded paths but rather with when we've tried every last-hop. Also this is the wrong check - at this point in the code we simply failed to find a path, you can't say anything about why.

Thanks for the review! (@TheBlueMatt) I understand the two issues:

  1. This should also cover Payee::Clear with route hints, not just Payee::Blinded
  2. At this point in the code we only know pathfinding failed, not why

For (2), would the right approach be to track inside add_entry! when route hint candidates (both blinded and private hop) are specifically rejected due to exhausted liquidity via used_liquidities, and only emit the specific error when that was the reason all hints failed? Or were you thinking of something simpler/different?

return Err("Failed to find a path to the given destination: all provided blinded path route hints were exhausted");
}
return Err("Failed to find a path to the given destination");
}

Expand Down Expand Up @@ -8475,7 +8478,7 @@ mod tests {
if let Err(err) = get_route(&nodes[0], &route_params, &netgraph,
Some(&first_hops.iter().collect::<Vec<_>>()), Arc::clone(&logger), &scorer,
&Default::default(), &random_seed_bytes) {
assert_eq!(err, "Failed to find a path to the given destination");
assert_eq!(err, "Failed to find a path to the given destination: all provided blinded path route hints were exhausted");
} else { panic!("Expected error") }

// Sending an exact amount accounting for the blinded path fee works.
Expand Down Expand Up @@ -8587,7 +8590,7 @@ mod tests {
if let Err(err) = get_route(
&our_id, &route_params, &netgraph, None, Arc::clone(&logger), &scorer, &Default::default(), &random_seed_bytes
) {
assert_eq!(err, "Failed to find a path to the given destination");
assert_eq!(err, "Failed to find a path to the given destination: all provided blinded path route hints were exhausted");
} else { panic!() }
}

Expand Down Expand Up @@ -8635,7 +8638,7 @@ mod tests {
if let Err(err) = get_route(
&our_id, &route_params, &netgraph, None, Arc::clone(&logger), &scorer, &Default::default(), &random_seed_bytes
) {
assert_eq!(err, "Failed to find a path to the given destination");
assert_eq!(err, "Failed to find a path to the given destination: all provided blinded path route hints were exhausted");
} else { panic!() }
}

Expand Down Expand Up @@ -8706,7 +8709,11 @@ mod tests {
&our_id, &route_params, &netgraph, Some(&first_hops.iter().collect::<Vec<_>>()),
Arc::clone(&logger), &scorer, &Default::default(), &random_seed_bytes
) {
assert_eq!(err, "Failed to find a path to the given destination");
if blinded_payee {
assert_eq!(err, "Failed to find a path to the given destination: all provided blinded path route hints were exhausted");
} else {
assert_eq!(err, "Failed to find a path to the given destination");
}
} else { panic!() }
}

Expand Down Expand Up @@ -8852,7 +8859,7 @@ mod tests {
Arc::clone(&logger), &scorer, &ProbabilisticScoringFeeParameters::default(),
&random_seed_bytes
) {
assert_eq!(err, "Failed to find a path to the given destination");
assert_eq!(err, "Failed to find a path to the given destination: all provided blinded path route hints were exhausted");
} else { panic!() }
}

Expand Down
Loading