diff options
author | Péter Szilágyi <peterke@gmail.com> | 2015-04-14 17:12:47 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2015-04-14 17:12:47 +0800 |
commit | 5205b2f19b9173580f9a9e727d74e202b8dd0f67 (patch) | |
tree | a43057307d4fb8c704953c6a82507bc5f473aaf1 /whisper/envelope.go | |
parent | 4af7743663fa3e444668b90878f64d0df4316deb (diff) | |
download | go-tangerine-5205b2f19b9173580f9a9e727d74e202b8dd0f67.tar.gz go-tangerine-5205b2f19b9173580f9a9e727d74e202b8dd0f67.tar.zst go-tangerine-5205b2f19b9173580f9a9e727d74e202b8dd0f67.zip |
whisper: fix anonymous broadcast drop, add broadcast tests
Diffstat (limited to 'whisper/envelope.go')
-rw-r--r-- | whisper/envelope.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/whisper/envelope.go b/whisper/envelope.go index 93e3ea1a3..9daaf6490 100644 --- a/whisper/envelope.go +++ b/whisper/envelope.go @@ -11,6 +11,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/crypto/ecies" "github.com/ethereum/go-ethereum/rlp" ) @@ -96,10 +97,14 @@ func (self *Envelope) Open(key *ecdsa.PrivateKey) (msg *Message, err error) { if key == nil { return message, nil } - switch message.decrypt(key) { + err = message.decrypt(key) + switch err { case nil: return message, nil + case ecies.ErrInvalidPublicKey: // Payload isn't encrypted + return message, err + default: return nil, fmt.Errorf("unable to open envelope, decrypt failed: %v", err) } |