mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 06:36:43 +00:00
Merge pull request #10 from dwhitena/status-whisper-fix
Fix for messaging with whisper identities
This commit is contained in:
commit
ded2df70e4
2 changed files with 6 additions and 2 deletions
|
|
@ -178,6 +178,9 @@ func (s *PublicWhisperAPI) Post(args PostArgs) (bool, error) {
|
|||
|
||||
// construct whisper message with transmission options
|
||||
message := NewMessage(common.FromHex(args.Payload))
|
||||
if len(message.Payload) == 0 && len(args.Payload) > 0 {
|
||||
message.Payload = []byte(args.Payload)
|
||||
}
|
||||
options := Options{
|
||||
To: crypto.ToECDSAPub(common.FromHex(args.To)),
|
||||
TTL: time.Duration(args.TTL) * time.Second,
|
||||
|
|
|
|||
|
|
@ -302,10 +302,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 {
|
||||
switch err {
|
||||
case nil:
|
||||
message.To = &key.PublicKey
|
||||
return message
|
||||
} else if err == ecies.ErrInvalidPublicKey {
|
||||
case ecies.ErrInvalidPublicKey:
|
||||
return message
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue