whisper: fix spurious From identity with untargeted messages

This commit is contained in:
Péter Szilágyi 2015-04-21 12:45:10 +03:00
parent 87447f9f3f
commit 15586368e5

View File

@ -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