Skip to content

Commit

Permalink
feat: map correct fleet according to the pubsub topic configured
Browse files Browse the repository at this point in the history
  • Loading branch information
danisharora099 committed May 14, 2024
1 parent 6f188ef commit a730d5a
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 41 deletions.
78 changes: 39 additions & 39 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 11 additions & 2 deletions packages/sdk/src/utils/discovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import {
wakuLocalPeerCacheDiscovery,
wakuPeerExchangeDiscovery
} from "@waku/discovery";
import { type Libp2pComponents, PubsubTopic } from "@waku/interfaces";
import {
DefaultPubsubTopic,
type Libp2pComponents,
PubsubTopic
} from "@waku/interfaces";

const DEFAULT_NODE_REQUIREMENTS = {
lightPush: 1,
Expand All @@ -16,8 +20,13 @@ const DEFAULT_NODE_REQUIREMENTS = {
export function defaultPeerDiscoveries(
pubsubTopics: PubsubTopic[]
): ((components: Libp2pComponents) => PeerDiscovery)[] {
// TODO: add a check to see if it is indeed TWN or if it is a custom network
const dnsFleet = pubsubTopics.includes(DefaultPubsubTopic)
? enrTree["TEST"]
: enrTree["SANDBOX"];

const discoveries = [
wakuDnsDiscovery([enrTree["SANDBOX"]], DEFAULT_NODE_REQUIREMENTS),
wakuDnsDiscovery([dnsFleet], DEFAULT_NODE_REQUIREMENTS),
wakuLocalPeerCacheDiscovery(),
wakuPeerExchangeDiscovery(pubsubTopics)
];
Expand Down

0 comments on commit a730d5a

Please sign in to comment.