diff options
author | Guillaume Ballet <gballet@gmail.com> | 2018-03-01 00:28:09 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-01 00:28:09 +0800 |
commit | 9b4e182ce5c0a82799cc3c455444c18c664fa996 (patch) | |
tree | ccafc915e6f3721b771ebed6d8bf3f7f5ef847bf /whisper/whisperv6/whisper.go | |
parent | 52bb0a1ec7f7b6c64a21291c1ca784763e09608d (diff) | |
parent | d24d10a764457937f1bda72053c82d98ac95dd7a (diff) | |
download | dexon-9b4e182ce5c0a82799cc3c455444c18c664fa996.tar dexon-9b4e182ce5c0a82799cc3c455444c18c664fa996.tar.gz dexon-9b4e182ce5c0a82799cc3c455444c18c664fa996.tar.bz2 dexon-9b4e182ce5c0a82799cc3c455444c18c664fa996.tar.lz dexon-9b4e182ce5c0a82799cc3c455444c18c664fa996.tar.xz dexon-9b4e182ce5c0a82799cc3c455444c18c664fa996.tar.zst dexon-9b4e182ce5c0a82799cc3c455444c18c664fa996.zip |
Merge pull request #16210 from gluk256/288-filter-optimization
whisper: message filtering optimization
Only run the message through filters who registered their interest.
Diffstat (limited to 'whisper/whisperv6/whisper.go')
-rw-r--r-- | whisper/whisperv6/whisper.go | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/whisper/whisperv6/whisper.go b/whisper/whisperv6/whisper.go index b0b601f03..81f59b3cc 100644 --- a/whisper/whisperv6/whisper.go +++ b/whisper/whisperv6/whisper.go @@ -928,24 +928,6 @@ func (whisper *Whisper) Envelopes() []*Envelope { return all } -// Messages iterates through all currently floating envelopes -// and retrieves all the messages, that this filter could decrypt. -func (whisper *Whisper) Messages(id string) []*ReceivedMessage { - result := make([]*ReceivedMessage, 0) - whisper.poolMu.RLock() - defer whisper.poolMu.RUnlock() - - if filter := whisper.filters.Get(id); filter != nil { - for _, env := range whisper.envelopes { - msg := filter.processEnvelope(env) - if msg != nil { - result = append(result, msg) - } - } - } - return result -} - // isEnvelopeCached checks if envelope with specific hash has already been received and cached. func (whisper *Whisper) isEnvelopeCached(hash common.Hash) bool { whisper.poolMu.Lock() |