diff options
author | Péter Szilágyi <peterke@gmail.com> | 2019-05-08 17:15:17 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-08 17:15:17 +0800 |
commit | 78477e4118d7ab57b7f56847153251439f24e884 (patch) | |
tree | 7bf7f15cf80f5c9a32f683bb62555c8575f98865 | |
parent | e770f62445e129d55680a02009e57bcd58f6a312 (diff) | |
parent | 85726fdb025038d06a8e8d0abd4e19d86dd9ef59 (diff) | |
download | go-tangerine-78477e4118d7ab57b7f56847153251439f24e884.tar go-tangerine-78477e4118d7ab57b7f56847153251439f24e884.tar.gz go-tangerine-78477e4118d7ab57b7f56847153251439f24e884.tar.bz2 go-tangerine-78477e4118d7ab57b7f56847153251439f24e884.tar.lz go-tangerine-78477e4118d7ab57b7f56847153251439f24e884.tar.xz go-tangerine-78477e4118d7ab57b7f56847153251439f24e884.tar.zst go-tangerine-78477e4118d7ab57b7f56847153251439f24e884.zip |
Merge pull request #19534 from karalabe/downloader-delay-fix
eth/downloader: fix header delays during chain dedup
-rw-r--r-- | eth/downloader/downloader.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/eth/downloader/downloader.go b/eth/downloader/downloader.go index 099eb5f47..95f2c2aee 100644 --- a/eth/downloader/downloader.go +++ b/eth/downloader/downloader.go @@ -892,6 +892,7 @@ func (d *Downloader) fetchHeaders(p *peerConnection, from uint64, pivot uint64) } } // Start pulling the header chain skeleton until all is done + ancestor := from getHeaders(from) for { @@ -962,6 +963,12 @@ func (d *Downloader) fetchHeaders(p *peerConnection, from uint64, pivot uint64) head = full } } + // If the head is below the common ancestor, we're actually deduplicating + // already existing chain segments, so use the ancestor as the fake head. + // Otherwise we might end up delaying header deliveries pointlessly. + if head < ancestor { + head = ancestor + } // If the head is way older than this batch, delay the last few headers if head+uint64(reorgProtThreshold) < headers[n-1].Number.Uint64() { delay := reorgProtHeaderDelay |