From c1a1cdab4b42ea3d77c02a3367cbbd3ab458d5bf Mon Sep 17 00:00:00 2001 From: Mario Sarcevic Date: Thu, 16 Nov 2023 13:59:34 +0100 Subject: [PATCH] fix: Prevent nodeInfoService from fetching NodeInfo of non-stardust networks + Small formatting fix --- api/src/initServices.ts | 7 ++++--- client/src/services/nodeInfoService.ts | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/api/src/initServices.ts b/api/src/initServices.ts index 56f607fb2..611a6d240 100644 --- a/api/src/initServices.ts +++ b/api/src/initServices.ts @@ -148,11 +148,12 @@ function initChrysalisServices(networkConfig: INetwork): void { ); ServiceFactory.register( `items-${networkConfig.network}`, - () => new ChrysalisItemsService(networkConfig.network)); - + () => new ChrysalisItemsService(networkConfig.network) + ); ServiceFactory.register( `stats-${networkConfig.network}`, - () => new ChrysalisStatsService(networkConfig)); + () => new ChrysalisStatsService(networkConfig) + ); } /** diff --git a/client/src/services/nodeInfoService.ts b/client/src/services/nodeInfoService.ts index 75f7dd044..8abc26ad3 100644 --- a/client/src/services/nodeInfoService.ts +++ b/client/src/services/nodeInfoService.ts @@ -50,9 +50,9 @@ export class NodeInfoService { */ public async buildCache(): Promise { const networksService = ServiceFactory.get("network"); - const allNetworks = networksService.networks(); + const stardustNetworks = networksService.networks().filter(n => n.protocolVersion === STARDUST); - for (const networkDetails of allNetworks) { + for (const networkDetails of stardustNetworks) { const apiClient = ServiceFactory.get(`api-client-${STARDUST}`); const network = networkDetails.network; const response: INodeInfoResponse = await apiClient.nodeInfo({ network });