remove unnecessary and potentially harmful check from heartbeat

- the check is unnecessary because peers emit PRUNE on Leave
- the check is harmful, because the ANNOUNCE message might have
  benn lost (or reordered after the GRAFT depending on the retry
  strategy), which would leave the mesh in an inconsistent state.
This commit is contained in:
vyzo 2018-02-21 19:03:12 +02:00 committed by Steven Allen
parent e8c5cf0914
commit ef730627ad

View File

@ -334,14 +334,6 @@ func (gs *GossipSubRouter) heartbeat() {
// maintain the mesh for topics we have joined // maintain the mesh for topics we have joined
for topic, peers := range gs.mesh { for topic, peers := range gs.mesh {
// check whether our peers are still in the topic
for p := range peers {
_, ok := gs.p.topics[topic][p]
if !ok {
delete(peers, p)
}
}
// do we have enough peers? // do we have enough peers?
if len(peers) < GossipSubDlo { if len(peers) < GossipSubDlo {
ineed := GossipSubD - len(peers) ineed := GossipSubD - len(peers)