Skip to main content

compute_extended_forward_paths

Function compute_extended_forward_paths 

Source
fn compute_extended_forward_paths<G>(
    graph: &G,
    src: &OffchainPublicKey,
    dest: &OffchainPublicKey,
    shorter_length: NonZeroUsize,
    take: usize,
    existing: &[PathWithCost],
) -> Vec<PathWithCost>
where G: NetworkGraphTraverse<NodeId = OffchainPublicKey> + NetworkGraphView<NodeId = OffchainPublicKey>, <G as NetworkGraphTraverse>::Observed: EdgeObservableRead + Send + 'static,
Expand description

Extended forward path search: find shorter paths using [EdgeCostFn::forward_without_self_loopback] and append dest to each one.

This handles the case where the last edge (relay -> dest) has no graph edge (e.g. no payment channel) but the path planner can still assume the last hop is reachable. Paths already found by Phase 1 are excluded via existing.

The cost from the shorter traversal is preserved as-is — the missing last edge contributes a neutral 1.0 multiplier (no quality data available).