Commit c7a8d0d2 authored by Adin Schmahmann's avatar Adin Schmahmann Committed by Steven Allen

SearchValue will only update k closest peers to have latest record

parent 85f88e1e
......@@ -191,7 +191,10 @@ func (dht *IpfsDHT) SearchValue(ctx context.Context, key string, opts ...routing
peers := q[0].globallyQueriedPeers.Peers()
peers = kb.SortClosestPeers(peers, kb.ConvertKey(key))
for _, p := range peers {
for i, p := range peers {
if i == dht.bucketSize {
break
}
if _, ok := peersWithBest[p]; !ok {
updatePeers = append(updatePeers, p)
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment