pub async fn find_providers(
endpoint: &Endpoint,
routing_table: &Arc<Mutex<RoutingTable>>,
staker_set: &Arc<dyn StakerSet>,
negative_cache: &NegativeProbeCache,
requester_id: NodeId,
target: Hash,
cfg: LookupConfig,
metrics: Option<&Metrics>,
) -> Vec<(NodeId, Coverage)>Expand description
Run the iterative FindValue lookup for target.
Returns the randomised, deduplicated, filter-survived provider
list. An empty return means convergence with no usable providers
— the caller should fall back to the on-chain origin directory
(ADR 022 § FIND_VALUE Flow) if applicable.
The function never panics or returns Err. Per-peer RPC
failures are classified: transport-level failures are absorbed
as empty responses and logged at debug!; an invalid Ed25519
NodeId (which implies state corruption upstream) is logged at
warn!; round-timeout aborts log the aborted-peer count at
warn!. The lookup is best-effort by spec; total failure
manifests as an empty return.
metrics is optional so the DHT test suite can drive a lookup without standing one up;
the production caller always passes Some, and it is the only way the round ceiling
below becomes observable.
Runs inside a dht_lookup span that records the rounds run and the
providers found; each round’s per-peer RPCs run inside it too.