aboutsummaryrefslogtreecommitdiffstats
path: root/whisper/message.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2015-04-21 16:43:11 +0800
committerPéter Szilágyi <peterke@gmail.com>2015-04-28 15:49:04 +0800
commit7f48eb8737878e352a65475382532db26f9fbc52 (patch)
tree7db869690505978a4f111b996e7357572f64211c /whisper/message.go
parent19bc4624eaefc2c8201260e7afa1a5893159bffc (diff)
downloadgo-tangerine-7f48eb8737878e352a65475382532db26f9fbc52.tar.gz
go-tangerine-7f48eb8737878e352a65475382532db26f9fbc52.tar.zst
go-tangerine-7f48eb8737878e352a65475382532db26f9fbc52.zip
whisper, xeth/whisper: surface TTL and hash to the API
Diffstat (limited to 'whisper/message.go')
-rw-r--r--whisper/message.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/whisper/message.go b/whisper/message.go
index 69d85b894..2b92d515c 100644
--- a/whisper/message.go
+++ b/whisper/message.go
@@ -21,10 +21,12 @@ type Message struct {
Flags byte // First bit is signature presence, rest reserved and should be random
Signature []byte
Payload []byte
- Sent int64
+
+ Sent time.Time // Time when the message was posted into the network
+ TTL time.Duration // Maximum time to live allowed for the message
To *ecdsa.PublicKey // Message recipient (identity used to decode the message)
- Hash common.Hash // Message envelope hash to act as a unique id in de-duplication
+ Hash common.Hash // Message envelope hash to act as a unique id
}
// Options specifies the exact way a message should be wrapped into an Envelope.
@@ -45,7 +47,7 @@ func NewMessage(payload []byte) *Message {
return &Message{
Flags: flags,
Payload: payload,
- Sent: time.Now().Unix(),
+ Sent: time.Now(),
}
}
@@ -66,6 +68,8 @@ func (self *Message) Wrap(pow time.Duration, options Options) (*Envelope, error)
if options.TTL == 0 {
options.TTL = DefaultTTL
}
+ self.TTL = options.TTL
+
// Sign and encrypt the message if requested
if options.From != nil {
if err := self.sign(options.From); err != nil {