diff --git a/common/types.go b/common/types.go index fdb2f919a0..7713c45f73 100644 --- a/common/types.go +++ b/common/types.go @@ -49,6 +49,7 @@ const ( NumRegionsInPrime = 3 NumZonesInRegion = 3 HierarchyDepth = 3 + NumChains = 1 + NumRegionsInPrime*(1+NumZonesInRegion) // Prime + R regions + RxZ zones ) var ( diff --git a/p2p/discover/table.go b/p2p/discover/table.go index 43f6cbe978..dff975516c 100644 --- a/p2p/discover/table.go +++ b/p2p/discover/table.go @@ -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. @@ -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