From 6bcaacd74b0133eb7e59a6179b86bb3818045818 Mon Sep 17 00:00:00 2001 From: vyzo Date: Mon, 23 Mar 2020 08:29:46 +0200 Subject: [PATCH] add backoff when pruning because of negative score --- gossipsub.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gossipsub.go b/gossipsub.go index d14b2ae..1021428 100644 --- a/gossipsub.go +++ b/gossipsub.go @@ -387,6 +387,8 @@ func (gs *GossipSubRouter) handleGraft(p peer.ID, ctl *pb.ControlMessage) []*pb. prune = append(prune, topic) // but we won't PX to them doPX = false + // add/refresh backoff so that we don't reGRAFT too early even if the score decays back up + gs.addBackoff(p, topic) continue } @@ -394,6 +396,7 @@ func (gs *GossipSubRouter) handleGraft(p peer.ID, ctl *pb.ControlMessage) []*pb. _, backoff := gs.backoff[topic][p] if backoff { log.Debugf("GRAFT: ignoring backed off peer %s", p) + // refresh the backoff gs.addBackoff(p, topic) prune = append(prune, topic) continue