diff options
author | obscuren <geffobscura@gmail.com> | 2014-12-10 07:03:50 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-12-10 07:03:50 +0800 |
commit | 984c7e6689f720e0b60a462e00793364de397909 (patch) | |
tree | 44ed06cf585efc3348d63a465b96c2dc84fb2bdf /whisper/envelope.go | |
parent | 87adff7e189ee0a1fd50a3ef30ba22482e60f314 (diff) | |
download | dexon-984c7e6689f720e0b60a462e00793364de397909.tar.gz dexon-984c7e6689f720e0b60a462e00793364de397909.tar.zst dexon-984c7e6689f720e0b60a462e00793364de397909.zip |
Added encryption for messages better API for sealing messages
Diffstat (limited to 'whisper/envelope.go')
-rw-r--r-- | whisper/envelope.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/whisper/envelope.go b/whisper/envelope.go index 8e66a7bbb..eb80098ad 100644 --- a/whisper/envelope.go +++ b/whisper/envelope.go @@ -16,8 +16,8 @@ const ( ) type Envelope struct { - Expiry int32 // Whisper protocol specifies int32, really should be int64 - Ttl int32 // ^^^^^^ + Expiry uint32 // Whisper protocol specifies int32, really should be int64 + Ttl uint32 // ^^^^^^ Topics [][]byte Data []byte Nonce uint32 @@ -52,11 +52,11 @@ func (self *Envelope) Hash() Hash { func NewEnvelope(ttl time.Duration, topics [][]byte, data *Message) *Envelope { exp := time.Now().Add(ttl) - return &Envelope{int32(exp.Unix()), int32(ttl.Seconds()), topics, data.Bytes(), 0, Hash{}} + return &Envelope{uint32(exp.Unix()), uint32(ttl.Seconds()), topics, data.Bytes(), 0, Hash{}} } -func (self *Envelope) Seal() { - self.proveWork(DefaultPow) +func (self *Envelope) Seal(pow time.Duration) { + self.proveWork(pow) } func (self *Envelope) proveWork(dura time.Duration) { |