Skip to content

Commit

Permalink
Increase Kademlia bucket & table sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
wizeguyy authored and gameofpointers committed Sep 28, 2023
1 parent 9159b79 commit 1e74a3c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions common/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const (
NumRegionsInPrime = 3
NumZonesInRegion = 3
HierarchyDepth = 3
NumChains = 1 + NumRegionsInPrime*(1+NumZonesInRegion) // Prime + R regions + RxZ zones
)

var (
Expand Down
10 changes: 5 additions & 5 deletions p2p/discover/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ import (
)

const (
alpha = 3 // Kademlia concurrency factor
bucketSize = 16 // Kademlia bucket size
maxReplacements = 10 // Size of per-bucket replacement list
alpha = 3 // Kademlia concurrency factor
bucketSize = 16 * common.NumChains // Kademlia bucket size
maxReplacements = 10 * common.NumChains // Size of per-bucket replacement list

// We keep buckets for the upper 1/15 of distances because
// it's very unlikely we'll ever encounter a node that's closer.
Expand All @@ -50,8 +50,8 @@ const (
bucketMinDistance = hashBits - nBuckets // Log distance of closest bucket

// IP address limits.
bucketIPLimit, bucketSubnet = 2, 24 // at most 2 addresses from the same /24
tableIPLimit, tableSubnet = 10, 24
bucketIPLimit, bucketSubnet = 2 * common.NumChains, 24 // Up to 2x num chains in network
tableIPLimit, tableSubnet = 10 * common.NumChains, 24 // Up to 10x num chains in network

refreshInterval = 30 * time.Minute
revalidateInterval = 10 * time.Second
Expand Down

0 comments on commit 1e74a3c

Please sign in to comment.