diff options
author | Felix Lange <fjl@twurst.com> | 2017-01-09 18:16:06 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2017-01-09 23:24:42 +0800 |
commit | b9b3efb09f9281a5859646d2dcf36b5813132efb (patch) | |
tree | f9dc8f9d82108b33bec4669b09a99d06d24239a9 /whisper/whisperv5 | |
parent | 0f34d506b5ae9b76de97318c906e56dddd5309f6 (diff) | |
download | dexon-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 'whisper/whisperv5')
-rw-r--r-- | whisper/whisperv5/filter.go | 2 | ||||
-rw-r--r-- | whisper/whisperv5/message_test.go | 4 | ||||
-rw-r--r-- | whisper/whisperv5/whisper_test.go | 18 |
3 files changed, 8 insertions, 16 deletions
diff --git a/whisper/whisperv5/filter.go b/whisper/whisperv5/filter.go index 3845d0c20..a386aa164 100644 --- a/whisper/whisperv5/filter.go +++ b/whisper/whisperv5/filter.go @@ -86,7 +86,7 @@ func (fs *Filters) NotifyWatchers(env *Envelope, p2pMessage bool) { continue } - match := false + var match bool if msg != nil { match = watcher.MatchMessage(msg) } else { diff --git a/whisper/whisperv5/message_test.go b/whisper/whisperv5/message_test.go index 3eb71653d..7c90f59c0 100644 --- a/whisper/whisperv5/message_test.go +++ b/whisper/whisperv5/message_test.go @@ -77,10 +77,8 @@ func singleMessageTest(t *testing.T, symmetric bool) { text := make([]byte, 0, 512) steg := make([]byte, 0, 512) - raw := make([]byte, 0, 1024) text = append(text, params.Payload...) steg = append(steg, params.Padding...) - raw = append(raw, params.Padding...) msg := NewSentMessage(params) env, err := msg.Wrap(params) @@ -238,10 +236,8 @@ func singleEnvelopeOpenTest(t *testing.T, symmetric bool) { text := make([]byte, 0, 512) steg := make([]byte, 0, 512) - raw := make([]byte, 0, 1024) text = append(text, params.Payload...) steg = append(steg, params.Padding...) - raw = append(raw, params.Padding...) msg := NewSentMessage(params) env, err := msg.Wrap(params) diff --git a/whisper/whisperv5/whisper_test.go b/whisper/whisperv5/whisper_test.go index dbe0627fa..b9cd9b1a0 100644 --- a/whisper/whisperv5/whisper_test.go +++ b/whisper/whisperv5/whisper_test.go @@ -50,20 +50,17 @@ func TestWhisperBasic(t *testing.T) { peerID := make([]byte, 64) randomize(peerID) - peer, err := w.getPeer(peerID) + peer, _ := w.getPeer(peerID) if peer != nil { - t.Fatalf("failed GetPeer.") + t.Fatal("found peer for random key.") } - err = w.MarkPeerTrusted(peerID) - if err == nil { + if err := w.MarkPeerTrusted(peerID); err == nil { t.Fatalf("failed MarkPeerTrusted.") } - err = w.RequestHistoricMessages(peerID, peerID) - if err == nil { + if err := w.RequestHistoricMessages(peerID, peerID); err == nil { t.Fatalf("failed RequestHistoricMessages.") } - err = w.SendP2PMessage(peerID, nil) - if err == nil { + if err := w.SendP2PMessage(peerID, nil); err == nil { t.Fatalf("failed SendP2PMessage.") } exist := w.HasSymKey("non-existing") @@ -85,11 +82,10 @@ func TestWhisperBasic(t *testing.T) { var derived []byte ver := uint64(0xDEADBEEF) - derived, err = deriveKeyMaterial(peerID, ver) - if err != unknownVersionError(ver) { + if _, err := deriveKeyMaterial(peerID, ver); err != unknownVersionError(ver) { t.Fatalf("failed deriveKeyMaterial with param = %v: %s.", peerID, err) } - derived, err = deriveKeyMaterial(peerID, 0) + derived, err := deriveKeyMaterial(peerID, 0) if err != nil { t.Fatalf("failed second deriveKeyMaterial with param = %v: %s.", peerID, err) } |