Skip to content

Commit a02a157

Browse files
f use CandidateRouteHop::OneHopBlinded
1 parent 5c0c9aa commit a02a157

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

lightning/src/routing/router.rs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,6 +1054,14 @@ impl<'a> CandidateRouteHop<'a> {
10541054
_ => CandidateHopId::Clear((self.short_channel_id().unwrap(), channel_direction)),
10551055
}
10561056
}
1057+
fn blinded_path(&self) -> Option<&'a BlindedPath> {
1058+
match self {
1059+
CandidateRouteHop::Blinded { hint, .. } | CandidateRouteHop::OneHopBlinded { hint, .. } => {
1060+
Some(&hint.1)
1061+
},
1062+
_ => None,
1063+
}
1064+
}
10571065
}
10581066

10591067
#[derive(Eq, Hash, PartialEq)]
@@ -1968,7 +1976,9 @@ where L::Target: Logger {
19681976
first_hop_targets.get(&intro_node_id).is_some() ||
19691977
network_nodes.get(&intro_node_id).is_some();
19701978
if !have_intro_node_in_graph { continue }
1971-
let candidate = CandidateRouteHop::Blinded { hint, hint_idx };
1979+
let candidate = if hint.1.blinded_hops.len() == 1 {
1980+
CandidateRouteHop::OneHopBlinded { hint, hint_idx }
1981+
} else { CandidateRouteHop::Blinded { hint, hint_idx } };
19721982
let mut path_contribution_msat = path_value_msat;
19731983
if let Some(hop_used_msat) = add_entry!(candidate, intro_node_id, maybe_dummy_payee_node_id,
19741984
0, path_contribution_msat, 0, 0_u64, 0, 0)
@@ -2401,11 +2411,11 @@ where L::Target: Logger {
24012411
}
24022412
let mut final_cltv_delta = final_cltv_expiry_delta;
24032413
let blinded_tail = payment_path.hops.last().map(|(h, _)| {
2404-
if let CandidateRouteHop::Blinded { hint, .. } = h.candidate {
2414+
if let Some(blinded_path) = h.candidate.blinded_path() {
24052415
final_cltv_delta = h.candidate.cltv_expiry_delta();
24062416
Some(BlindedTail {
2407-
hops: hint.1.blinded_hops.clone(),
2408-
blinding_point: hint.1.blinding_point,
2417+
hops: blinded_path.blinded_hops.clone(),
2418+
blinding_point: blinded_path.blinding_point,
24092419
excess_final_cltv_expiry_delta: 0,
24102420
final_value_msat: h.fee_msat,
24112421
})

0 commit comments

Comments
 (0)