diff options
author | Péter Szilágyi <peterke@gmail.com> | 2016-10-31 23:26:44 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2016-10-31 23:26:44 +0800 |
commit | 8b10617bba7be804ab6516a36ae02dd6175ed46d (patch) | |
tree | f762f3b52faad7ef2345bf41ebe4d8711943d78b /eth/downloader/downloader.go | |
parent | 90b16a3e85d82241f4505a7db0f95c2f312642a6 (diff) | |
download | dexon-8b10617bba7be804ab6516a36ae02dd6175ed46d.tar dexon-8b10617bba7be804ab6516a36ae02dd6175ed46d.tar.gz dexon-8b10617bba7be804ab6516a36ae02dd6175ed46d.tar.bz2 dexon-8b10617bba7be804ab6516a36ae02dd6175ed46d.tar.lz dexon-8b10617bba7be804ab6516a36ae02dd6175ed46d.tar.xz dexon-8b10617bba7be804ab6516a36ae02dd6175ed46d.tar.zst dexon-8b10617bba7be804ab6516a36ae02dd6175ed46d.zip |
eth/downloader: reduce fast sync block requirements, fix test
Diffstat (limited to 'eth/downloader/downloader.go')
-rw-r--r-- | eth/downloader/downloader.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/eth/downloader/downloader.go b/eth/downloader/downloader.go index 1cf69ea71..683794470 100644 --- a/eth/downloader/downloader.go +++ b/eth/downloader/downloader.go @@ -67,8 +67,8 @@ var ( 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 fsHeaderForceVerify = 24 // Number of headers to verify before and after the pivot to accept it - fsPivotInterval = 512 // Number of headers out of which to randomize the pivot point - fsMinFullBlocks = 1024 // Number of blocks to retrieve fully even in fast sync + fsPivotInterval = 256 // Number of headers out of which to randomize the pivot point + fsMinFullBlocks = 64 // Number of blocks to retrieve fully even in fast sync fsCriticalTrials = uint32(32) // Number of times to retry in the cricical section before bailing ) @@ -480,6 +480,11 @@ func (d *Downloader) spawnSync(origin uint64, fetchers ...func() error) error { d.queue.Close() d.cancel() wg.Wait() + + // If sync failed in the critical section, bump the fail counter + if err != nil && d.mode == FastSync && d.fsPivotLock != nil { + atomic.AddUint32(&d.fsPivotFails, 1) + } return err } @@ -1190,7 +1195,6 @@ func (d *Downloader) processHeaders(origin uint64, td *big.Int) error { } } } - atomic.AddUint32(&d.fsPivotFails, 1) } } }() |