diff options
author | Péter Szilágyi <peterke@gmail.com> | 2017-01-07 01:30:44 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-07 01:30:44 +0800 |
commit | ac93a6ff6cd1200ab0fb67a5bd0c02cb70646632 (patch) | |
tree | 2b06aa1b360f1488264058d04e399e84b898f0d8 /swarm/storage | |
parent | 444fc892b0a860218dab3e421d92c33408b9eb6d (diff) | |
parent | 13e3b2f433c48fe81423c1a13e9a5194ece61b01 (diff) | |
download | go-tangerine-ac93a6ff6cd1200ab0fb67a5bd0c02cb70646632.tar.gz go-tangerine-ac93a6ff6cd1200ab0fb67a5bd0c02cb70646632.tar.zst go-tangerine-ac93a6ff6cd1200ab0fb67a5bd0c02cb70646632.zip |
Merge pull request #3525 from fjl/all-gosimple-cleanup
all: clean up lint issues, remove more dead code
Diffstat (limited to 'swarm/storage')
-rw-r--r-- | swarm/storage/dbstore.go | 2 | ||||
-rw-r--r-- | swarm/storage/dpa_test.go | 4 | ||||
-rw-r--r-- | swarm/storage/types.go | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/swarm/storage/dbstore.go b/swarm/storage/dbstore.go index 5ecc5c500..4ddebb021 100644 --- a/swarm/storage/dbstore.go +++ b/swarm/storage/dbstore.go @@ -354,7 +354,7 @@ func (s *DbStore) Get(key Key) (chunk *Chunk, err error) { hasher := s.hashfunc() hasher.Write(data) hash := hasher.Sum(nil) - if bytes.Compare(hash, key) != 0 { + if !bytes.Equal(hash, key) { s.db.Delete(getDataKey(index.Idx)) err = fmt.Errorf("invalid chunk. hash=%x, key=%v", hash, key[:]) return diff --git a/swarm/storage/dpa_test.go b/swarm/storage/dpa_test.go index 1cde1c00e..a68232407 100644 --- a/swarm/storage/dpa_test.go +++ b/swarm/storage/dpa_test.go @@ -67,7 +67,7 @@ func TestDPArandom(t *testing.T) { ioutil.WriteFile("/tmp/result.bzz.16M", resultSlice, 0666) localStore.memStore = NewMemStore(dbStore, defaultCacheCapacity) resultReader = dpa.Retrieve(key) - for i, _ := range resultSlice { + for i := range resultSlice { resultSlice[i] = 0 } n, err = resultReader.ReadAt(resultSlice, 0) @@ -128,7 +128,7 @@ func TestDPA_capacity(t *testing.T) { dpa.ChunkStore = localStore // localStore.dbStore.setCapacity(0) resultReader = dpa.Retrieve(key) - for i, _ := range resultSlice { + for i := range resultSlice { resultSlice[i] = 0 } n, err = resultReader.ReadAt(resultSlice, 0) diff --git a/swarm/storage/types.go b/swarm/storage/types.go index 0dcbc0100..c36522012 100644 --- a/swarm/storage/types.go +++ b/swarm/storage/types.go @@ -41,7 +41,7 @@ func (x Key) Size() uint { } func (x Key) isEqual(y Key) bool { - return bytes.Compare(x, y) == 0 + return bytes.Equal(x, y) } func (h Key) bits(i, j uint) uint { |