aboutsummaryrefslogtreecommitdiffstats
path: root/whisper/whisperv5/peer.go
diff options
context:
space:
mode:
authorgluk256 <gluk256@users.noreply.github.com>2017-02-24 01:46:32 +0800
committerFelix Lange <fjl@users.noreply.github.com>2017-02-24 01:46:32 +0800
commit11539030cdf91f5a74bf205e8f52f9f08aace8e3 (patch)
tree11ad7d946473f8a59cc512bdafcf81627b7993b5 /whisper/whisperv5/peer.go
parent357732a8404c9fe4d02f041d20a0d05381a3e6d1 (diff)
downloadgo-tangerine-11539030cdf91f5a74bf205e8f52f9f08aace8e3.tar.gz
go-tangerine-11539030cdf91f5a74bf205e8f52f9f08aace8e3.tar.zst
go-tangerine-11539030cdf91f5a74bf205e8f52f9f08aace8e3.zip
whisper: expiry refactoring (#3706)
Diffstat (limited to 'whisper/whisperv5/peer.go')
-rw-r--r--whisper/whisperv5/peer.go10
1 files changed, 2 insertions, 8 deletions
diff --git a/whisper/whisperv5/peer.go b/whisper/whisperv5/peer.go
index e137613f5..315401aea 100644
--- a/whisper/whisperv5/peer.go
+++ b/whisper/whisperv5/peer.go
@@ -133,20 +133,14 @@ func (peer *Peer) marked(envelope *Envelope) bool {
// expire iterates over all the known envelopes in the host and removes all
// expired (unknown) ones from the known list.
func (peer *Peer) expire() {
- // Assemble the list of available envelopes
- available := set.NewNonTS()
- for _, envelope := range peer.host.Envelopes() {
- available.Add(envelope.Hash())
- }
- // Cross reference availability with known status
unmark := make(map[common.Hash]struct{})
peer.known.Each(func(v interface{}) bool {
- if !available.Has(v.(common.Hash)) {
+ if !peer.host.isEnvelopeCached(v.(common.Hash)) {
unmark[v.(common.Hash)] = struct{}{}
}
return true
})
- // Dump all known but unavailable
+ // Dump all known but no longer cached
for hash := range unmark {
peer.known.Remove(hash)
}