aboutsummaryrefslogtreecommitdiffstats
path: root/whisper
diff options
context:
space:
mode:
Diffstat (limited to 'whisper')
-rw-r--r--whisper/envelope.go1
-rw-r--r--whisper/messages_test.go5
2 files changed, 3 insertions, 3 deletions
diff --git a/whisper/envelope.go b/whisper/envelope.go
index 066e20f6a..9d28dfa6b 100644
--- a/whisper/envelope.go
+++ b/whisper/envelope.go
@@ -79,6 +79,7 @@ func (self *Envelope) Open(prv *ecdsa.PrivateKey) (msg *Message, err error) {
if prv != nil {
message.Payload, err = crypto.Decrypt(prv, payload)
switch err {
+ case nil: // OK
case ecies.ErrInvalidPublicKey: // Payload isn't encrypted
message.Payload = payload
return &message, err
diff --git a/whisper/messages_test.go b/whisper/messages_test.go
index cba103011..93caa31b3 100644
--- a/whisper/messages_test.go
+++ b/whisper/messages_test.go
@@ -40,12 +40,11 @@ func TestMessageEncryptDecrypt(t *testing.T) {
msg1, err := envelope.Open(prv2)
if err != nil {
- fmt.Println(err)
+ t.Error(err)
t.FailNow()
}
if !bytes.Equal(msg1.Payload, data) {
- fmt.Println("encryption error. data did not match")
- t.FailNow()
+ t.Error("encryption error. data did not match")
}
}