Skip to content

Commit eecab78

Browse files
Avoid routing over previously failed blinded payment paths.
1 parent d5dc311 commit eecab78

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

lightning/src/routing/router.rs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1362,6 +1362,14 @@ impl<'a> CandidateRouteHop<'a> {
13621362
_ => None,
13631363
}
13641364
}
1365+
fn blinded_hint_idx(&self) -> Option<usize> {
1366+
match self {
1367+
CandidateRouteHop::Blinded { hint_idx, .. } | CandidateRouteHop::OneHopBlinded { hint_idx, .. } => {
1368+
Some(*hint_idx)
1369+
},
1370+
_ => None,
1371+
}
1372+
}
13651373
/// Returns the source node id of current hop.
13661374
///
13671375
/// Source node id refers to the node forwarding the HTLC through this hop.
@@ -2113,8 +2121,15 @@ where L::Target: Logger {
21132121
(amount_to_transfer_over_msat < $next_hops_path_htlc_minimum_msat &&
21142122
recommended_value_msat >= $next_hops_path_htlc_minimum_msat));
21152123

2116-
let payment_failed_on_this_channel = scid_opt.map_or(false,
2117-
|scid| payment_params.previously_failed_channels.contains(&scid));
2124+
let payment_failed_on_this_channel = match scid_opt {
2125+
Some(scid) => payment_params.previously_failed_channels.contains(&scid),
2126+
None if $candidate.blinded_hint_idx().is_some() => {
2127+
payment_params.previously_failed_blinded_path_idxs.contains(
2128+
&($candidate.blinded_hint_idx().unwrap() as u64)
2129+
)
2130+
},
2131+
_ => false,
2132+
};
21182133

21192134
let (should_log_candidate, first_hop_details) = match $candidate {
21202135
CandidateRouteHop::FirstHop { details, .. } => (true, Some(details)),

0 commit comments

Comments
 (0)