From 712bab2c64f4e89909d378d735219a04aeefe453 Mon Sep 17 00:00:00 2001 From: vyzo Date: Mon, 2 Mar 2020 20:51:51 +0200 Subject: [PATCH] remove peers with negative score from fanout --- gossipsub.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gossipsub.go b/gossipsub.go index 4699978..4ebe85d 100644 --- a/gossipsub.go +++ b/gossipsub.go @@ -737,10 +737,11 @@ func (gs *GossipSubRouter) heartbeat() { // maintain our fanout for topics we are publishing but we have not joined for topic, peers := range gs.fanout { - // check whether our peers are still in the topic + // check whether our peers are still in the topic and don't have a negative score for p := range peers { _, ok := gs.p.topics[topic][p] - if !ok { + score := gs.score.Score(p) + if !ok || score < 0 { delete(peers, p) } }