Skip to content

Commit 32ab7a9

Browse files
Avoid building routes over previously failed blinded payment paths.
1 parent 23ef253 commit 32ab7a9

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
@@ -1383,6 +1383,15 @@ impl<'a> CandidateRouteHop<'a> {
13831383
_ => None,
13841384
}
13851385
}
1386+
fn blinded_hint_idx(&self) -> Option<usize> {
1387+
match self {
1388+
Self::Blinded(BlindedPathCandidate { hint_idx, .. }) |
1389+
Self::OneHopBlinded(OneHopBlindedPathCandidate { hint_idx, .. }) => {
1390+
Some(*hint_idx)
1391+
},
1392+
_ => None,
1393+
}
1394+
}
13861395
/// Returns the source node id of current hop.
13871396
///
13881397
/// Source node id refers to the node forwarding the HTLC through this hop.
@@ -2134,8 +2143,15 @@ where L::Target: Logger {
21342143
(amount_to_transfer_over_msat < $next_hops_path_htlc_minimum_msat &&
21352144
recommended_value_msat >= $next_hops_path_htlc_minimum_msat));
21362145

2137-
let payment_failed_on_this_channel = scid_opt.map_or(false,
2138-
|scid| payment_params.previously_failed_channels.contains(&scid));
2146+
let payment_failed_on_this_channel = match scid_opt {
2147+
Some(scid) => payment_params.previously_failed_channels.contains(&scid),
2148+
None => match $candidate.blinded_hint_idx() {
2149+
Some(idx) => {
2150+
payment_params.previously_failed_blinded_path_idxs.contains(&(idx as u64))
2151+
},
2152+
None => false,
2153+
},
2154+
};
21392155

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

0 commit comments

Comments
 (0)