fix: fix iteration of peers

This commit is contained in:
Derrick Hammer 2023-09-01 20:46:37 -04:00
parent 006c49409c
commit fabda024ad
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 2 additions and 2 deletions

View File

@ -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);
}
}