aboutsummaryrefslogtreecommitdiffstats
path: root/whisper/whisperv5
diff options
context:
space:
mode:
Diffstat (limited to 'whisper/whisperv5')
-rw-r--r--whisper/whisperv5/filter.go2
-rw-r--r--whisper/whisperv5/message_test.go4
-rw-r--r--whisper/whisperv5/whisper_test.go18
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)
}