Skip to content

Commit

Permalink
f use CandidateRouteHop::OneHopBlinded
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinewallace committed Jun 16, 2023
1 parent fc6756e commit 8d4b6da
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions lightning/src/routing/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1054,6 +1054,14 @@ impl<'a> CandidateRouteHop<'a> {
_ => CandidateHopId::Clear((self.short_channel_id().unwrap(), channel_direction)),
}
}
fn blinded_path(&self) -> Option<&'a BlindedPath> {
match self {
CandidateRouteHop::Blinded { hint, .. } | CandidateRouteHop::OneHopBlinded { hint, .. } => {
Some(&hint.1)
},
_ => None,
}
}
}

#[derive(Eq, Hash, PartialEq)]
Expand Down Expand Up @@ -1968,7 +1976,9 @@ where L::Target: Logger {
first_hop_targets.get(&intro_node_id).is_some() ||
network_nodes.get(&intro_node_id).is_some();
if !have_intro_node_in_graph { continue }
let candidate = CandidateRouteHop::Blinded { hint, hint_idx };
let candidate = if hint.1.blinded_hops.len() == 1 {
CandidateRouteHop::OneHopBlinded { hint, hint_idx }
} else { CandidateRouteHop::Blinded { hint, hint_idx } };
let mut path_contribution_msat = path_value_msat;
if let Some(hop_used_msat) = add_entry!(candidate, intro_node_id, maybe_dummy_payee_node_id,
0, path_contribution_msat, 0, 0_u64, 0, 0)
Expand Down Expand Up @@ -2401,11 +2411,11 @@ where L::Target: Logger {
}
let mut final_cltv_delta = final_cltv_expiry_delta;
let blinded_tail = payment_path.hops.last().map(|(h, _)| {
if let CandidateRouteHop::Blinded { hint, .. } = h.candidate {
if let Some(blinded_path) = h.candidate.blinded_path() {
final_cltv_delta = h.candidate.cltv_expiry_delta();
Some(BlindedTail {
hops: hint.1.blinded_hops.clone(),
blinding_point: hint.1.blinding_point,
hops: blinded_path.blinded_hops.clone(),
blinding_point: blinded_path.blinding_point,
excess_final_cltv_expiry_delta: 0,
final_value_msat: h.fee_msat,
})
Expand Down

0 comments on commit 8d4b6da

Please sign in to comment.