aboutsummaryrefslogtreecommitdiffstats
path: root/eth/downloader/downloader.go
diff options
context:
space:
mode:
authorgary rong <garyrong0905@gmail.com>2018-03-09 17:51:30 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-03-09 17:51:30 +0800
commit77da203547b83c70d12552a86bb7beee52f6383e (patch)
tree66074b1a60b022333bc3872d0e0a31ec58bda624 /eth/downloader/downloader.go
parent307846d046d66c04ec9750c2219f7c93b53cb2c9 (diff)
downloaddexon-77da203547b83c70d12552a86bb7beee52f6383e.tar
dexon-77da203547b83c70d12552a86bb7beee52f6383e.tar.gz
dexon-77da203547b83c70d12552a86bb7beee52f6383e.tar.bz2
dexon-77da203547b83c70d12552a86bb7beee52f6383e.tar.lz
dexon-77da203547b83c70d12552a86bb7beee52f6383e.tar.xz
dexon-77da203547b83c70d12552a86bb7beee52f6383e.tar.zst
dexon-77da203547b83c70d12552a86bb7beee52f6383e.zip
eth: update higest block we know during the sync if a higher was found (#16283)
* eth: update higest block we know during the sync if a higher was found * eth: avoid useless sync in fast sync
Diffstat (limited to 'eth/downloader/downloader.go')
-rw-r--r--eth/downloader/downloader.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/eth/downloader/downloader.go b/eth/downloader/downloader.go
index 70febf4cb..62842adbc 100644
--- a/eth/downloader/downloader.go
+++ b/eth/downloader/downloader.go
@@ -1296,6 +1296,14 @@ func (d *Downloader) processHeaders(origin uint64, pivot uint64, td *big.Int) er
headers = headers[limit:]
origin += uint64(limit)
}
+
+ // Update the highest block number we know if a higher one is found.
+ d.syncStatsLock.Lock()
+ if d.syncStatsChainHeight < origin {
+ d.syncStatsChainHeight = origin - 1
+ }
+ d.syncStatsLock.Unlock()
+
// Signal the content downloaders of the availablility of new tasks
for _, ch := range []chan bool{d.bodyWakeCh, d.receiptWakeCh} {
select {