Skip to content

Commit

Permalink
Merge pull request #2143 from OriginTrail/v6/develop
Browse files Browse the repository at this point in the history
fix kBucketSize
  • Loading branch information
zeroxbt authored Oct 20, 2022
2 parents 2f6317b + 898c345 commit 8f38c33
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/modules/network/implementation/libp2p-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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) {
Expand Down

0 comments on commit 8f38c33

Please sign in to comment.