Expand description
§Stateful peer walk by XOR distance
PeerIterator is the execution primitive for every DHT operation: given a target
crate::tools::types::Id and a
crate::client::peer_tracker::peer_tracker::PeerTracker, hand back peers in order
of decreasing closeness while remembering which ones have already been tried.
Two knobs tune the walk:
- High-watermark on
crate::tools::tools::LeadingAgreementBits— onceNiterations have passed without finding a peer closer than the best so far, the iterator gives up. This is the standard Kademlia “no further progress possible” signal. - Cache radius — supplied by
crate::client::caching::cache_radius_tracker. Peers closer than the recorded cache radius are skipped, because whatever we’d fetch from them is already cached further out; fetching again just hammers the closest nodes.