diff --git a/src/lib/waku_relay/get_waku_peers.ts b/src/lib/waku_relay/get_relay_peers.ts similarity index 97% rename from src/lib/waku_relay/get_waku_peers.ts rename to src/lib/waku_relay/get_relay_peers.ts index cda6067db3..e31a5280f3 100644 --- a/src/lib/waku_relay/get_waku_peers.ts +++ b/src/lib/waku_relay/get_relay_peers.ts @@ -13,7 +13,7 @@ import { RelayCodec, WakuRelayPubsub } from './index'; * @returns {Set} * */ -export function getWakuPeers( +export function getRelayPeers( router: WakuRelayPubsub, topic: string, count: number, diff --git a/src/lib/waku_relay/index.ts b/src/lib/waku_relay/index.ts index 7b1789db11..09bc941033 100644 --- a/src/lib/waku_relay/index.ts +++ b/src/lib/waku_relay/index.ts @@ -7,7 +7,7 @@ import { SignaturePolicy } from 'libp2p-interfaces/src/pubsub/signature-policy'; import { WakuMessage } from '../waku_message'; import { RelayCodec, RelayDefaultTopic } from './constants'; -import { getWakuPeers } from './get_waku_peers'; +import { getRelayPeers } from './get_relay_peers'; import { RelayHeartbeat } from './relay_heartbeat'; export * from './constants'; @@ -59,7 +59,7 @@ export class WakuRelayPubsub extends Gossipsub { }); if (fanoutPeers.size < this._options.D) { // we need more peers; eager, as this would get fixed in the next heartbeat - getWakuPeers( + getRelayPeers( this, topic, this._options.D - fanoutPeers.size, @@ -77,7 +77,7 @@ export class WakuRelayPubsub extends Gossipsub { this.fanout.delete(topic); this.lastpub.delete(topic); } else { - const peers = getWakuPeers( + const peers = getRelayPeers( this, topic, this._options.D, @@ -132,7 +132,7 @@ export class WakuRelayPubsub extends Gossipsub { meshPeers = this.fanout.get(topic); if (!meshPeers) { // If we are not in the fanout, then pick peers in topic above the publishThreshold - const peers = getWakuPeers(this, topic, this._options.D, (id) => { + const peers = getRelayPeers(this, topic, this._options.D, (id) => { return ( this.score.score(id) >= this._options.scoreThresholds.publishThreshold diff --git a/src/lib/waku_relay/relay_heartbeat.ts b/src/lib/waku_relay/relay_heartbeat.ts index 0842bfee6a..7d418e945e 100644 --- a/src/lib/waku_relay/relay_heartbeat.ts +++ b/src/lib/waku_relay/relay_heartbeat.ts @@ -3,7 +3,7 @@ import { Heartbeat } from 'libp2p-gossipsub/src/heartbeat'; import { shuffle } from 'libp2p-gossipsub/src/utils'; import * as constants from './constants'; -import { getWakuPeers } from './get_waku_peers'; +import { getRelayPeers } from './get_relay_peers'; export class RelayHeartbeat extends Heartbeat { /** @@ -152,7 +152,7 @@ export class RelayHeartbeat extends Heartbeat { if (peers.size < Dlo) { const backoff = this.gossipsub.backoff.get(topic); const ineed = D - peers.size; - const peersSet = getWakuPeers( + const peersSet = getRelayPeers( this.gossipsub, topic, ineed, @@ -239,7 +239,7 @@ export class RelayHeartbeat extends Heartbeat { if (outbound < Dout) { const ineed = Dout - outbound; const backoff = this.gossipsub.backoff.get(topic); - getWakuPeers(this.gossipsub, topic, ineed, (id: string): boolean => { + getRelayPeers(this.gossipsub, 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) && @@ -278,7 +278,7 @@ export class RelayHeartbeat extends Heartbeat { this.gossipsub._options.scoreThresholds.opportunisticGraftThreshold ) { const backoff = this.gossipsub.backoff.get(topic); - const peersToGraft = getWakuPeers( + const peersToGraft = getRelayPeers( this.gossipsub, topic, constants.RelayOpportunisticGraftPeers, @@ -334,7 +334,7 @@ export class RelayHeartbeat extends Heartbeat { // do we need more peers? if (fanoutPeers.size < D) { const ineed = D - fanoutPeers.size; - const peersSet = getWakuPeers( + const peersSet = getRelayPeers( this.gossipsub, topic, ineed,