diff --git a/packages/sdk/src/protocols/base_protocol.ts b/packages/sdk/src/protocols/base_protocol.ts index 4550072b84..3ef5cc1df8 100644 --- a/packages/sdk/src/protocols/base_protocol.ts +++ b/packages/sdk/src/protocols/base_protocol.ts @@ -29,12 +29,12 @@ export class BaseProtocolSDK implements IBaseProtocolSDK { ) { this.log = new Logger(`sdk:${core.multicodec}`); - this.peerManager = new PeerManager(connectionManager, core, this.log); - this.numPeersToUse = options?.numPeersToUse ?? DEFAULT_NUM_PEERS_TO_USE; const maintainPeersInterval = options?.maintainPeersInterval ?? DEFAULT_MAINTAIN_PEERS_INTERVAL; + this.peerManager = new PeerManager(connectionManager, core, this.log); + this.log.info( `Initializing BaseProtocolSDK with numPeersToUse: ${this.numPeersToUse}, maintainPeersInterval: ${maintainPeersInterval}ms` ); @@ -42,7 +42,7 @@ export class BaseProtocolSDK implements IBaseProtocolSDK { } public get connectedPeers(): Peer[] { - return this.peerManager.getPeers(); + return this.peerManager.getPeers().slice(0, this.numPeersToUse); } /** diff --git a/packages/sdk/src/waku/waku.ts b/packages/sdk/src/waku/waku.ts index c461a63ab3..1c450420cf 100644 --- a/packages/sdk/src/waku/waku.ts +++ b/packages/sdk/src/waku/waku.ts @@ -72,7 +72,7 @@ export class WakuNode implements IWaku { public constructor( public readonly pubsubTopics: PubsubTopic[], - options: WakuOptions, + options: CreateWakuNodeOptions, libp2p: Libp2p, protocolsEnabled: ProtocolsEnabled, relay?: IRelay @@ -111,12 +111,12 @@ export class WakuNode implements IWaku { } if (protocolsEnabled.lightpush) { - const lightPush = wakuLightPush(this.connectionManager); + const lightPush = wakuLightPush(this.connectionManager, options); this.lightPush = lightPush(libp2p); } if (protocolsEnabled.filter) { - const filter = wakuFilter(this.connectionManager); + const filter = wakuFilter(this.connectionManager, options); this.filter = filter(libp2p); }