From 15586368e52f49a0f7ea28f890af49d196760846 Mon Sep 17 00:00:00 2001 From: Péter Szilágyi Date: Tue, 21 Apr 2015 12:45:10 +0300 Subject: whisper: fix spurious From identity with untargeted messages --- whisper/whisper.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/whisper/whisper.go b/whisper/whisper.go index 59a1a63c4..61999f07a 100644 --- a/whisper/whisper.go +++ b/whisper/whisper.go @@ -260,9 +260,11 @@ func (self *Whisper) open(envelope *Envelope) *Message { // Iterate over the keys and try to decrypt the message for _, key := range self.keys { message, err := envelope.Open(key) - if err == nil || err == ecies.ErrInvalidPublicKey { + if err == nil { message.To = &key.PublicKey return message + } else if err == ecies.ErrInvalidPublicKey { + return message } } // Failed to decrypt, don't return anything -- cgit