Skip to main content

rebuild_candidates

Function rebuild_candidates 

Source
async fn rebuild_candidates<R, S>(
    resolver: &R,
    selector: &S,
    weighting: WeightingParams,
    me: OffchainPublicKey,
    src_key: OffchainPublicKey,
    dest_key: OffchainPublicKey,
    hops: usize,
    kind: &'static str,
) -> Result<Option<WeightedCollection<ValidatedPath>>>
where R: ChainKeyOperations + ChainReadChannelOperations + Send + Sync, S: PathSelector,
Expand description

Rebuilds the weighted candidate collection for one (source, destination, hops) triple from whatever the graph currently says.

Shared by the lazy cache fill, the background sweep and the on-demand recompute, so all three necessarily agree: a divergence here would make a session’s weights depend on which of the three happened to run last.

Ok(None) means the selector offered nothing, or nothing survived validation. Callers decide what that means — a fill turns it into PathNotFound, a refresh leaves the existing entry alone. Err is reserved for a selector that actually failed.