aboutsummaryrefslogtreecommitdiffstats
path: root/whisper/envelope.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2015-04-14 18:24:43 +0800
committerPéter Szilágyi <peterke@gmail.com>2015-04-14 18:24:43 +0800
commit59bff465053312013253f8c4288b6fb0c1e3e4e1 (patch)
tree8384e2228a634749295727750e95e48d8338a66e /whisper/envelope.go
parent5205b2f19b9173580f9a9e727d74e202b8dd0f67 (diff)
downloadgo-tangerine-59bff465053312013253f8c4288b6fb0c1e3e4e1.tar
go-tangerine-59bff465053312013253f8c4288b6fb0c1e3e4e1.tar.gz
go-tangerine-59bff465053312013253f8c4288b6fb0c1e3e4e1.tar.bz2
go-tangerine-59bff465053312013253f8c4288b6fb0c1e3e4e1.tar.lz
go-tangerine-59bff465053312013253f8c4288b6fb0c1e3e4e1.tar.xz
go-tangerine-59bff465053312013253f8c4288b6fb0c1e3e4e1.tar.zst
go-tangerine-59bff465053312013253f8c4288b6fb0c1e3e4e1.zip
whisper: general cleanups, documentation
Diffstat (limited to 'whisper/envelope.go')
-rw-r--r--whisper/envelope.go12
1 files changed, 1 insertions, 11 deletions
diff --git a/whisper/envelope.go b/whisper/envelope.go
index 9daaf6490..0a817e26e 100644
--- a/whisper/envelope.go
+++ b/whisper/envelope.go
@@ -24,7 +24,7 @@ type Envelope struct {
Data []byte
Nonce uint32
- hash common.Hash
+ hash common.Hash // Cached hash of the envelope to avoid rehashing every time
}
// NewEnvelope wraps a Whisper message with expiration and destination data
@@ -59,16 +59,6 @@ func (self *Envelope) Seal(pow time.Duration) {
}
}
-// valid checks whether the claimed proof of work was indeed executed.
-// TODO: Is this really useful? Isn't this always true?
-func (self *Envelope) valid() bool {
- d := make([]byte, 64)
- copy(d[:32], self.rlpWithoutNonce())
- binary.BigEndian.PutUint32(d[60:], self.Nonce)
-
- return common.FirstBitSet(common.BigD(crypto.Sha3(d))) > 0
-}
-
// rlpWithoutNonce returns the RLP encoded envelope contents, except the nonce.
func (self *Envelope) rlpWithoutNonce() []byte {
enc, _ := rlp.EncodeToBytes([]interface{}{self.Expiry, self.TTL, self.Topics, self.Data})