aboutsummaryrefslogtreecommitdiffstats
path: root/whisper/whisperv5/envelope.go
diff options
context:
space:
mode:
authorgluk256 <gluk256@users.noreply.github.com>2016-12-02 03:09:22 +0800
committerFelix Lange <fjl@twurst.com>2016-12-02 03:09:22 +0800
commit2dcf75a722f193ef5528f5af8fb4fd7c5824fded (patch)
treea30e617df7e75bc8afd3d38cf3388b2bb986479a /whisper/whisperv5/envelope.go
parent671fd94e256fb33761dc3b0ae2b8b6374d1d9576 (diff)
downloaddexon-2dcf75a722f193ef5528f5af8fb4fd7c5824fded.tar
dexon-2dcf75a722f193ef5528f5af8fb4fd7c5824fded.tar.gz
dexon-2dcf75a722f193ef5528f5af8fb4fd7c5824fded.tar.bz2
dexon-2dcf75a722f193ef5528f5af8fb4fd7c5824fded.tar.lz
dexon-2dcf75a722f193ef5528f5af8fb4fd7c5824fded.tar.xz
dexon-2dcf75a722f193ef5528f5af8fb4fd7c5824fded.tar.zst
dexon-2dcf75a722f193ef5528f5af8fb4fd7c5824fded.zip
whisper/shhapi, whisper/whisperv5: refactoring (#3364)
* Filter refactoring * API tests added + bugfix * fixed the error logs * FilterID fixed * test cases fixed * key generation updated * POW updated * got rid of redundant stuff
Diffstat (limited to 'whisper/whisperv5/envelope.go')
-rw-r--r--whisper/whisperv5/envelope.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/whisper/whisperv5/envelope.go b/whisper/whisperv5/envelope.go
index 57d454a08..3d048bb44 100644
--- a/whisper/whisperv5/envelope.go
+++ b/whisper/whisperv5/envelope.go
@@ -73,7 +73,7 @@ func NewEnvelope(ttl uint32, topic TopicType, salt []byte, aesNonce []byte, msg
}
func (e *Envelope) IsSymmetric() bool {
- return e.AESNonce != nil
+ return len(e.AESNonce) > 0
}
func (e *Envelope) isAsymmetric() bool {
@@ -131,7 +131,7 @@ func (e *Envelope) calculatePoW(diff uint32) {
h = crypto.Keccak256(buf)
firstBit := common.FirstBitSet(common.BigD(h))
x := math.Pow(2, float64(firstBit))
- x /= float64(len(e.Data))
+ x /= float64(len(e.Data)) // we only count e.Data, other variable-sized members are checked in Whisper.add()
x /= float64(e.TTL + diff)
e.pow = x
}