From fabda024ad788fcb00e398e73f75afb3e944db30 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Fri, 1 Sep 2023 20:46:37 -0400 Subject: [PATCH] fix: fix iteration of peers --- src/service/registry.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/service/registry.ts b/src/service/registry.ts index 4137331..cf47997 100644 --- a/src/service/registry.ts +++ b/src/service/registry.ts @@ -100,7 +100,7 @@ export class RegistryService { this.logger.verbose("[registry] broadcastEntry"); const updateMessage = this.serializeRegistryEntry(sre); - for (const p of Object.values(this.node.services.p2p.peers)) { + for (const p of [...this.node.services.p2p.peers.values()]) { if (receivedFrom == null || p.id !== receivedFrom.id) { p.sendMessage(updateMessage); } @@ -116,7 +116,7 @@ export class RegistryService { const req = p.takeBytes(); // TODO: Use shard system if there are more than X peers - for (const peer of Object.values(this.node.services.p2p.peers)) { + for (const peer of [...this.node.services.p2p.peers.values()]) { peer.sendMessage(req); } }