diff options
Diffstat (limited to 'whisper/message.go')
-rw-r--r-- | whisper/message.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/whisper/message.go b/whisper/message.go index 2b92d515c..a80380a92 100644 --- a/whisper/message.go +++ b/whisper/message.go @@ -120,9 +120,12 @@ func (self *Message) encrypt(key *ecdsa.PublicKey) (err error) { } // decrypt decrypts an encrypted payload with a private key. -func (self *Message) decrypt(key *ecdsa.PrivateKey) (err error) { - self.Payload, err = crypto.Decrypt(key, self.Payload) - return +func (self *Message) decrypt(key *ecdsa.PrivateKey) error { + cleartext, err := crypto.Decrypt(key, self.Payload) + if err == nil { + self.Payload = cleartext + } + return err } // hash calculates the SHA3 checksum of the message flags and payload. |