Skip to content

Commit

Permalink
fix: finding outbound peers in heartbeat (#266)
Browse files Browse the repository at this point in the history
  • Loading branch information
twoeths authored Jun 6, 2022
1 parent 80a2748 commit 17c25a1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2440,7 +2440,13 @@ export class GossipSub extends EventEmitter<GossipsubEvents> implements Initiali
const backoff = this.backoff.get(topic)
const newPeers = this.getRandomGossipPeers(topic, ineed, (id: string): boolean => {
// filter our current mesh peers, direct peers, peers we are backing off, peers with negative score
return !peers.has(id) && !this.direct.has(id) && (!backoff || !backoff.has(id)) && getScore(id) >= 0
return (
!peers.has(id) &&
!this.direct.has(id) &&
(!backoff || !backoff.has(id)) &&
getScore(id) >= 0 &&
this.outbound.get(id) === true
)
})
newPeers.forEach((p) => graftPeer(p, InclusionReason.Outbound))
}
Expand Down

0 comments on commit 17c25a1

Please sign in to comment.