Skip to content

Commit c3aec26

Browse files
Avoid routing over previously failed blinded payment paths.
1 parent 5ca6ffa commit c3aec26

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

lightning/src/routing/router.rs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1382,6 +1382,15 @@ impl<'a> CandidateRouteHop<'a> {
13821382
_ => None,
13831383
}
13841384
}
1385+
fn blinded_hint_idx(&self) -> Option<usize> {
1386+
match self {
1387+
Self::Blinded(BlindedPathCandidate { hint_idx, .. }) |
1388+
Self::OneHopBlinded(OneHopBlindedPathCandidate { hint_idx, .. }) => {
1389+
Some(*hint_idx)
1390+
},
1391+
_ => None,
1392+
}
1393+
}
13851394
/// Returns the source node id of current hop.
13861395
///
13871396
/// Source node id refers to the node forwarding the HTLC through this hop.
@@ -2133,8 +2142,15 @@ where L::Target: Logger {
21332142
(amount_to_transfer_over_msat < $next_hops_path_htlc_minimum_msat &&
21342143
recommended_value_msat >= $next_hops_path_htlc_minimum_msat));
21352144

2136-
let payment_failed_on_this_channel = scid_opt.map_or(false,
2137-
|scid| payment_params.previously_failed_channels.contains(&scid));
2145+
let payment_failed_on_this_channel = match scid_opt {
2146+
Some(scid) => payment_params.previously_failed_channels.contains(&scid),
2147+
None if $candidate.blinded_hint_idx().is_some() => {
2148+
payment_params.previously_failed_blinded_path_idxs.contains(
2149+
&($candidate.blinded_hint_idx().unwrap() as u64)
2150+
)
2151+
},
2152+
_ => false,
2153+
};
21382154

21392155
let (should_log_candidate, first_hop_details) = match $candidate {
21402156
CandidateRouteHop::FirstHop(hop) => (true, Some(hop.details)),

0 commit comments

Comments
 (0)