Skip to content

Commit

Permalink
fix: Prevent nodeInfoService from fetching NodeInfo of non-stardust n…
Browse files Browse the repository at this point in the history
…etworks + Small formatting fix
  • Loading branch information
msarcev committed Nov 16, 2023
1 parent 2b481f6 commit c1a1cda
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions api/src/initServices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions client/src/services/nodeInfoService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ export class NodeInfoService {
*/
public async buildCache(): Promise<void> {
const networksService = ServiceFactory.get<NetworkService>("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<StardustApiClient>(`api-client-${STARDUST}`);
const network = networkDetails.network;
const response: INodeInfoResponse = await apiClient.nodeInfo({ network });
Expand Down

0 comments on commit c1a1cda

Please sign in to comment.