Skip to content

Commit

Permalink
fix kBucketSize
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroxbt committed Oct 20, 2022
1 parent 0268563 commit e7c3f2c
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 e7c3f2c

Please sign in to comment.