aboutsummaryrefslogtreecommitdiffstats
path: root/swarm
diff options
context:
space:
mode:
authorAnton Evangelatov <anton.evangelatov@gmail.com>2019-03-09 00:28:57 +0800
committerViktor TrĂ³n <viktor.tron@gmail.com>2019-03-09 00:28:57 +0800
commitbb55b0fb5318faf45f3774fac0b412d0594e1661 (patch)
tree86b366e2bf2c5a73e95e182d4bd1ef99c237605e /swarm
parent2cfe0bed9f0d96e3b0750cf3a6aa7f72894af53d (diff)
downloadgo-tangerine-bb55b0fb5318faf45f3774fac0b412d0594e1661.tar
go-tangerine-bb55b0fb5318faf45f3774fac0b412d0594e1661.tar.gz
go-tangerine-bb55b0fb5318faf45f3774fac0b412d0594e1661.tar.bz2
go-tangerine-bb55b0fb5318faf45f3774fac0b412d0594e1661.tar.lz
go-tangerine-bb55b0fb5318faf45f3774fac0b412d0594e1661.tar.xz
go-tangerine-bb55b0fb5318faf45f3774fac0b412d0594e1661.tar.zst
go-tangerine-bb55b0fb5318faf45f3774fac0b412d0594e1661.zip
swarm/storage: add comparison towards leveldb.ErrNotFound (#19243)
* swarm/storage: add comparison towards leveldb.ErrNotFound * swarm/storage: wrap leveldb ErrNotFound
Diffstat (limited to 'swarm')
-rw-r--r--swarm/storage/ldbstore.go5
-rw-r--r--swarm/storage/netstore.go4
2 files changed, 7 insertions, 2 deletions
diff --git a/swarm/storage/ldbstore.go b/swarm/storage/ldbstore.go
index 766a9e031..fd5ec9e30 100644
--- a/swarm/storage/ldbstore.go
+++ b/swarm/storage/ldbstore.go
@@ -1005,7 +1005,10 @@ func (s *LDBStore) get(addr Address) (chunk Chunk, err error) {
if err != nil {
log.Trace("ldbstore.get chunk found but could not be accessed", "key", addr, "err", err)
s.deleteNow(index, getIndexKey(addr), s.po(addr))
- return
+ if err == leveldb.ErrNotFound {
+ return nil, ErrChunkNotFound
+ }
+ return nil, err
}
}
diff --git a/swarm/storage/netstore.go b/swarm/storage/netstore.go
index 9e32578a8..cb6c1c9cf 100644
--- a/swarm/storage/netstore.go
+++ b/swarm/storage/netstore.go
@@ -29,6 +29,7 @@ import (
"github.com/ethereum/go-ethereum/swarm/spancontext"
"github.com/opentracing/opentracing-go"
olog "github.com/opentracing/opentracing-go/log"
+ "github.com/syndtr/goleveldb/leveldb"
lru "github.com/hashicorp/golang-lru"
)
@@ -167,7 +168,8 @@ func (n *NetStore) get(ctx context.Context, ref Address) (Chunk, func(context.Co
chunk, err := n.store.Get(ctx, ref)
if err != nil {
- if err != ErrChunkNotFound {
+ // TODO: Fix comparison - we should be comparing against leveldb.ErrNotFound, this error should be wrapped.
+ if err != ErrChunkNotFound && err != leveldb.ErrNotFound {
log.Debug("Received error from LocalStore other than ErrNotFound", "err", err)
}
// The chunk is not available in the LocalStore, let's get the fetcher for it, or create a new one