Skip to content

Commit ddccea7

Browse files
committed
Fixed "to" field
1 parent 58ba290 commit ddccea7

3 files changed

Lines changed: 7 additions & 1 deletion

File tree

‎whisper/message.go‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ type Message struct {
1212
Signature []byte
1313
Payload []byte
1414
Sent int64
15+
16+
To *ecdsa.PublicKey
1517
}
1618

1719
func NewMessage(payload []byte) *Message {

‎whisper/whisper.go‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,8 @@ func (self *Whisper) postEvent(envelope *Envelope) {
256256
func (self *Whisper) open(envelope *Envelope) (*Message, *ecdsa.PrivateKey) {
257257
for _, key := range self.keys {
258258
if message, err := envelope.Open(key); err == nil || (err != nil && err == ecies.ErrInvalidPublicKey) {
259+
message.To = &key.PublicKey
260+
259261
return message, key
260262
}
261263
}

‎xeth/whisper.go‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,17 @@ type Options struct {
9999
type WhisperMessage struct {
100100
ref *whisper.Message
101101
Payload string `json:"payload"`
102+
To string `json:"to"`
102103
From string `json:"from"`
103-
Sent int64 `json:"time"`
104+
Sent int64 `json:"sent"`
104105
}
105106

106107
func NewWhisperMessage(msg *whisper.Message) WhisperMessage {
107108
return WhisperMessage{
108109
ref: msg,
109110
Payload: toHex(msg.Payload),
110111
From: toHex(crypto.FromECDSAPub(msg.Recover())),
112+
To: toHex(crypto.FromECDSAPub(msg.To)),
111113
Sent: msg.Sent,
112114
}
113115
}

0 commit comments

Comments
 (0)