From e7c3f2c32c5aaa4f05ea1dd678b127e6b522429e Mon Sep 17 00:00:00 2001 From: zeroxbt Date: Thu, 20 Oct 2022 17:30:04 +0200 Subject: [PATCH] fix kBucketSize --- src/modules/network/implementation/libp2p-service.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/modules/network/implementation/libp2p-service.js b/src/modules/network/implementation/libp2p-service.js index 457141030d..5121a21dc5 100644 --- a/src/modules/network/implementation/libp2p-service.js +++ b/src/modules/network/implementation/libp2p-service.js @@ -230,7 +230,7 @@ class Libp2pService { return serializedPeers.map((peer) => this.deserializePeer(peer)); } - async sortPeers(key, peers, count = this.config.kBucketSize) { + async sortPeers(key, peers, count = this.config.dht.kBucketSize) { const keyHash = await this.toHash(new TextEncoder().encode(key)); const sorted = pipe( peers, @@ -254,7 +254,10 @@ class Libp2pService { async findNodesLocal(key) { const keyHash = await this.toHash(new TextEncoder().encode(key)); - const nodes = this.node._dht.routingTable.closestPeers(keyHash, this.config.kBucketSize); + const nodes = this.node._dht.routingTable.closestPeers( + keyHash, + this.config.dht.kBucketSize, + ); const result = []; for await (const node of nodes) {