浏览代码

eth/downloader: bump the download queue size to prevent starvation

Péter Szilágyi 9 年之前
父节点
当前提交
93c0012000
共有 2 个文件被更改,包括 6 次插入1 次删除
  1. 5 0
      eth/downloader/downloader_test.go
  2. 1 1
      eth/downloader/queue.go

+ 5 - 0
eth/downloader/downloader_test.go

@@ -43,6 +43,11 @@ var (
 	genesis     = core.GenesisBlockForTesting(testdb, testAddress, big.NewInt(1000000000))
 	genesis     = core.GenesisBlockForTesting(testdb, testAddress, big.NewInt(1000000000))
 )
 )
 
 
+// Reduce the block cache limit, otherwise the tests will be very heavy.
+func init() {
+	blockCacheLimit = 1024
+}
+
 // makeChain creates a chain of n blocks starting at and including parent.
 // makeChain creates a chain of n blocks starting at and including parent.
 // the returned hash chain is ordered head->parent. In addition, every 3rd block
 // the returned hash chain is ordered head->parent. In addition, every 3rd block
 // contains a transaction and every 5th an uncle to allow testing correct block
 // contains a transaction and every 5th an uncle to allow testing correct block

+ 1 - 1
eth/downloader/queue.go

@@ -39,7 +39,7 @@ import (
 )
 )
 
 
 var (
 var (
-	blockCacheLimit   = 1024 // Maximum number of blocks to cache before throttling the download
+	blockCacheLimit   = 8192 // Maximum number of blocks to cache before throttling the download
 	maxInFlightStates = 4096 // Maximum number of state downloads to allow concurrently
 	maxInFlightStates = 4096 // Maximum number of state downloads to allow concurrently
 )
 )