From f2d1fbdfa5069c9687c3fe467fe9882ffa26f9de Mon Sep 17 00:00:00 2001 From: lanzafame Date: Sun, 2 Aug 2020 09:57:34 +1000 Subject: [PATCH] Add explanation to channel magic --- chain/messagepool/messagepool.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/chain/messagepool/messagepool.go b/chain/messagepool/messagepool.go index b51fee546..00820e78e 100644 --- a/chain/messagepool/messagepool.go +++ b/chain/messagepool/messagepool.go @@ -243,6 +243,10 @@ func (mp *MessagePool) Close() error { } func (mp *MessagePool) Prune() { + //so, its a single slot buffered channel. The first send fills the channel, + //the second send goes through when the pruning starts, + //and the third send goes through (and noops) after the pruning finishes + //and goes through the loop again mp.pruneTrigger <- struct{}{} mp.pruneTrigger <- struct{}{} mp.pruneTrigger <- struct{}{}