From 295bab223d3608cedc814e9ab6cc31d43a90344d Mon Sep 17 00:00:00 2001 From: Vlad Date: Mon, 12 Dec 2016 11:22:54 +0100 Subject: [PATCH] whisper: moved the check, changed the default PoW --- whisper/whisperv5/doc.go | 2 +- whisper/whisperv5/filter.go | 4 ---- whisper/whisperv5/whisper.go | 4 +++- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/whisper/whisperv5/doc.go b/whisper/whisperv5/doc.go index 3a9e27ca03..8f5453e35c 100644 --- a/whisper/whisperv5/doc.go +++ b/whisper/whisperv5/doc.go @@ -56,7 +56,7 @@ const ( AESNonceMaxLength = 12 MaxMessageLength = 0xFFFF // todo: remove this restriction after testing. this should be regulated by PoW. - MinimumPoW = 10.0 // todo: review after testing. + MinimumPoW = 1.0 // todo: review after testing. padSizeLimitLower = 128 // it can not be less - we don't want to reveal the absence of signature padSizeLimitUpper = 256 // just an arbitrary number, could be changed without losing compatibility diff --git a/whisper/whisperv5/filter.go b/whisper/whisperv5/filter.go index 889201e33e..99cfa54650 100644 --- a/whisper/whisperv5/filter.go +++ b/whisper/whisperv5/filter.go @@ -77,10 +77,6 @@ func (fs *Filters) Get(i uint32) *Filter { } func (fs *Filters) NotifyWatchers(env *Envelope, messageCode uint64) { - if env == nil { - return - } - fs.mutex.RLock() var msg *ReceivedMessage for j, watcher := range fs.watchers { diff --git a/whisper/whisperv5/whisper.go b/whisper/whisperv5/whisper.go index 2381ce4443..9a01083714 100644 --- a/whisper/whisperv5/whisper.go +++ b/whisper/whisperv5/whisper.go @@ -500,7 +500,9 @@ func (w *Whisper) processQueue() { w.poolMu.Lock() e := w.envelopes[i.hash] w.poolMu.Unlock() - w.filters.NotifyWatchers(e, i.code) + if e != nil { + w.filters.NotifyWatchers(e, i.code) + } } } }