Skip to content

Commit 17c25a1

Browse files
authored
fix: finding outbound peers in heartbeat (#266)
1 parent 80a2748 commit 17c25a1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/index.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2440,7 +2440,13 @@ export class GossipSub extends EventEmitter<GossipsubEvents> implements Initiali
24402440
const backoff = this.backoff.get(topic)
24412441
const newPeers = this.getRandomGossipPeers(topic, ineed, (id: string): boolean => {
24422442
// filter our current mesh peers, direct peers, peers we are backing off, peers with negative score
2443-
return !peers.has(id) && !this.direct.has(id) && (!backoff || !backoff.has(id)) && getScore(id) >= 0
2443+
return (
2444+
!peers.has(id) &&
2445+
!this.direct.has(id) &&
2446+
(!backoff || !backoff.has(id)) &&
2447+
getScore(id) >= 0 &&
2448+
this.outbound.get(id) === true
2449+
)
24442450
})
24452451
newPeers.forEach((p) => graftPeer(p, InclusionReason.Outbound))
24462452
}

0 commit comments

Comments
 (0)