diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go index 45203aa1f1..64bd5808ec 100644 --- a/cmd/utils/cmd.go +++ b/cmd/utils/cmd.go @@ -35,7 +35,7 @@ import ( ) const ( - importBatchSize = 2500 + importBatchSize = 1 ) // Fatalf formats a message to standard error and exits the program. diff --git a/eth/downloader/downloader.go b/eth/downloader/downloader.go index da586b370c..f9d7247645 100644 --- a/eth/downloader/downloader.go +++ b/eth/downloader/downloader.go @@ -58,8 +58,9 @@ var ( qosTuningImpact = 0.25 // Impact that a new tuning target has on the previous value maxQueuedHeaders = 32 * 1024 // [eth/62] Maximum number of headers to queue for import (DOS protection) - maxHeadersProcess = 2048 // Number of header download results to import at once into the chain - maxResultsProcess = 2048 // Number of content download results to import at once into the chain + // set maxHeadersProcess & maxResultsProcess to 1 so calcPastMedianTime/flux dont implode. + maxHeadersProcess = 1 // Number of header download results to import at once into the chain + maxResultsProcess = 1 // Number of content download results to import at once into the chain fsHeaderCheckFrequency = 100 // Verification frequency of the downloaded headers during fast sync fsHeaderSafetyNet = 2048 // Number of headers to discard in case a chain violation is detected @@ -389,6 +390,14 @@ func (d *Downloader) synchronise(id string, hash common.Hash, td *big.Int, mode if d.mode == FastSync && atomic.LoadUint32(&d.fsPivotFails) >= fsCriticalTrials { d.mode = FullSync } + + // If FastSync its safe to increase maxResultsProcess + if d.mode == FastSync { + maxResultsProcess = 2048 + } else { + maxResultsProcess = 1 + } + // Retrieve the origin peer and initiate the downloading process p := d.peers.Peer(id) if p == nil {