whsiper: refactoring

This commit is contained in:
Vlad
2018-02-27 23:38:20 +01:00
parent 014d8d9837
commit c733792be4
4 changed files with 22 additions and 61 deletions

View File

@@ -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()