Skip to content

Commit 4bac045

Browse files
committed
fix: remove local provider check
It doesn't actually work. Blocks are stored under /blocks and have been since 2015. Furthermore, this is just wrong. We shouldn't go digging through the datastore to see if we happen to have the block. If we want something like this, we should include a blockstore in the provider manager.
1 parent 6c82b40 commit 4bac045

File tree

1 file changed

+0
-12
lines changed

1 file changed

+0
-12
lines changed

handlers.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -316,20 +316,8 @@ func (dht *IpfsDHT) handleGetProviders(ctx context.Context, p peer.ID, pmes *pb.
316316

317317
resp := pb.NewMessage(pmes.GetType(), pmes.GetKey(), pmes.GetClusterLevel())
318318

319-
// check if we have this value, to add ourselves as provider.
320-
has, err := dht.datastore.Has(convertToDsKey(key))
321-
if err != nil && err != ds.ErrNotFound {
322-
// FIXME: This doesn't work reliably. If we want this check, we
323-
// need a _blockstore_.
324-
logger.Errorw("error checking datastore for block", "key", key, "error", err)
325-
has = false
326-
}
327-
328319
// setup providers
329320
providers := dht.ProviderManager.GetProviders(ctx, key)
330-
if has {
331-
providers = append(providers, dht.self)
332-
}
333321

334322
if len(providers) > 0 {
335323
// TODO: pstore.PeerInfos should move to core (=> peerstore.AddrInfos).

0 commit comments

Comments
 (0)