Commit 71c05a8c authored by Steven Allen's avatar Steven Allen

fix(bootstrap): don't bootstrap more than 16 buckets

We can't generate target IDs in buckets beyond bucket 15 so there's no point.
parent 645ba5b6
......@@ -95,6 +95,12 @@ func (dht *IpfsDHT) bootstrapBuckets(ctx context.Context) {
}
buckets := dht.routingTable.GetAllBuckets()
if len(buckets) > 16 {
// Don't bother bootstrapping more than 16 buckets.
// GenRandPeerID can't generate target peer IDs with more than
// 16 bits specified anyways.
buckets = buckets[:16]
}
for bucketID, bucket := range buckets {
if time.Since(bucket.RefreshedAt()) > dht.bootstrapPeriod {
// gen rand peer in the bucket
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment