Skip to content

fix: finding outbound peers in heartbeat #266

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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