aboutsummaryrefslogtreecommitdiffstats
path: root/swarm/network
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2017-01-09 18:16:06 +0800
committerFelix Lange <fjl@twurst.com>2017-01-09 23:24:42 +0800
commitb9b3efb09f9281a5859646d2dcf36b5813132efb (patch)
treef9dc8f9d82108b33bec4669b09a99d06d24239a9 /swarm/network
parent0f34d506b5ae9b76de97318c906e56dddd5309f6 (diff)
downloaddexon-b9b3efb09f9281a5859646d2dcf36b5813132efb.tar
dexon-b9b3efb09f9281a5859646d2dcf36b5813132efb.tar.gz
dexon-b9b3efb09f9281a5859646d2dcf36b5813132efb.tar.bz2
dexon-b9b3efb09f9281a5859646d2dcf36b5813132efb.tar.lz
dexon-b9b3efb09f9281a5859646d2dcf36b5813132efb.tar.xz
dexon-b9b3efb09f9281a5859646d2dcf36b5813132efb.tar.zst
dexon-b9b3efb09f9281a5859646d2dcf36b5813132efb.zip
all: fix ineffectual assignments and remove uses of crypto.Sha3
go get github.com/gordonklaus/ineffassign ineffassign .
Diffstat (limited to 'swarm/network')
-rw-r--r--swarm/network/kademlia/kademlia_test.go6
-rw-r--r--swarm/network/syncdb_test.go10
2 files changed, 8 insertions, 8 deletions
diff --git a/swarm/network/kademlia/kademlia_test.go b/swarm/network/kademlia/kademlia_test.go
index 66edfe654..417ccecae 100644
--- a/swarm/network/kademlia/kademlia_test.go
+++ b/swarm/network/kademlia/kademlia_test.go
@@ -58,9 +58,9 @@ func (n *testNode) LastActive() time.Time {
}
func TestOn(t *testing.T) {
- addr, ok := gen(Address{}, quickrand).(Address)
- other, ok := gen(Address{}, quickrand).(Address)
- if !ok {
+ addr, ok1 := gen(Address{}, quickrand).(Address)
+ other, ok2 := gen(Address{}, quickrand).(Address)
+ if !ok1 || !ok2 {
t.Errorf("oops")
}
kad := New(addr, NewKadParams())
diff --git a/swarm/network/syncdb_test.go b/swarm/network/syncdb_test.go
index ed43fbd06..21453a110 100644
--- a/swarm/network/syncdb_test.go
+++ b/swarm/network/syncdb_test.go
@@ -63,7 +63,7 @@ func newTestSyncDb(priority, bufferSize, batchSize int, dbdir string, t *testing
dbdir: dbdir,
t: t,
}
- h := crypto.Sha3Hash([]byte{0})
+ h := crypto.Keccak256Hash([]byte{0})
key := storage.Key(h[:])
self.syncDb = newSyncDb(db, key, uint(priority), uint(bufferSize), uint(batchSize), self.deliver)
// kick off db iterator right away, if no items on db this will allow
@@ -79,7 +79,7 @@ func (self *testSyncDb) close() {
func (self *testSyncDb) push(n int) {
for i := 0; i < n; i++ {
- self.buffer <- storage.Key(crypto.Sha3([]byte{byte(self.c)}))
+ self.buffer <- storage.Key(crypto.Keccak256([]byte{byte(self.c)}))
self.sent = append(self.sent, self.c)
self.c++
}
@@ -126,7 +126,7 @@ func (self *testSyncDb) expect(n int, db bool) {
if self.at+1 > len(self.delivered) {
self.t.Fatalf("expected %v, got %v", self.at+1, len(self.delivered))
}
- if len(self.sent) > self.at && !bytes.Equal(crypto.Sha3([]byte{byte(self.sent[self.at])}), self.delivered[self.at]) {
+ if len(self.sent) > self.at && !bytes.Equal(crypto.Keccak256([]byte{byte(self.sent[self.at])}), self.delivered[self.at]) {
self.t.Fatalf("expected delivery %v/%v/%v to be hash of %v, from db: %v = %v", i, n, self.at, self.sent[self.at], ok, db)
glog.V(logger.Debug).Infof("%v/%v/%v to be hash of %v, from db: %v = %v", i, n, self.at, self.sent[self.at], ok, db)
}
@@ -195,7 +195,7 @@ func TestSaveSyncDb(t *testing.T) {
go s.dbRead(false, 0, s.deliver)
s.expect(amount, true)
for i, key := range s.delivered {
- expKey := crypto.Sha3([]byte{byte(i)})
+ expKey := crypto.Keccak256([]byte{byte(i)})
if !bytes.Equal(key, expKey) {
t.Fatalf("delivery %v expected to be key %x, got %x", i, expKey, key)
}
@@ -204,7 +204,7 @@ func TestSaveSyncDb(t *testing.T) {
s.expect(amount, false)
for i := amount; i < 2*amount; i++ {
key := s.delivered[i]
- expKey := crypto.Sha3([]byte{byte(i - amount)})
+ expKey := crypto.Keccak256([]byte{byte(i - amount)})
if !bytes.Equal(key, expKey) {
t.Fatalf("delivery %v expected to be key %x, got %x", i, expKey, key)
}