all: fix ineffectual assignments and remove uses of crypto.Sha3
go get github.com/gordonklaus/ineffassign ineffassign .
This commit is contained in:
@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user