From 50c7cd16d1872a02112c6002bc2d58588f58885e Mon Sep 17 00:00:00 2001 From: Sasha Date: Thu, 11 Sep 2025 22:34:22 +0200 Subject: [PATCH] add peer cache support --- .../src/lib/connection_manager/bootstrap_trigger.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/core/src/lib/connection_manager/bootstrap_trigger.ts b/packages/core/src/lib/connection_manager/bootstrap_trigger.ts index 03251a9827..3052784060 100644 --- a/packages/core/src/lib/connection_manager/bootstrap_trigger.ts +++ b/packages/core/src/lib/connection_manager/bootstrap_trigger.ts @@ -1,5 +1,5 @@ import { PeerId } from "@libp2p/interface"; -import { Libp2p } from "@waku/interfaces"; +import { Libp2p, Tags } from "@waku/interfaces"; import { Logger } from "@waku/utils"; type BootstrapTriggerConstructorOptions = { @@ -73,10 +73,10 @@ export class BootstrapTrigger implements IBootstrapTrigger { const bootstrapComponents = Object.values(this.libp2p.components.components) .filter((c) => !!c) - .filter( - (c: unknown) => - (c as { [Symbol.toStringTag]: string })[Symbol.toStringTag] === - "@waku/bootstrap" + .filter((c: unknown) => + [`@waku/${Tags.BOOTSTRAP}`, `@waku/${Tags.PEER_CACHE}`].includes( + (c as { [Symbol.toStringTag]: string })?.[Symbol.toStringTag] + ) ); if (bootstrapComponents.length === 0) { @@ -90,7 +90,8 @@ export class BootstrapTrigger implements IBootstrapTrigger { bootstrapComponents.forEach((component) => { try { - (component as { start: () => void }).start(); + (component as { stop: () => void })?.stop?.(); + (component as { start: () => void })?.start?.(); log.info("Successfully started bootstrap component"); } catch (error) { log.error("Failed to start bootstrap component", error);