mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 01:43:47 +00:00
eth: update higest block we know during the sync if a higher was found
This commit is contained in:
parent
3ec1b9a92d
commit
ea04ad00fa
2 changed files with 9 additions and 1 deletions
|
|
@ -1296,6 +1296,14 @@ func (d *Downloader) processHeaders(origin uint64, pivot uint64, td *big.Int) er
|
||||||
headers = headers[limit:]
|
headers = headers[limit:]
|
||||||
origin += uint64(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
|
||||||
|
}
|
||||||
|
d.syncStatsLock.Unlock()
|
||||||
|
|
||||||
// Signal the content downloaders of the availablility of new tasks
|
// Signal the content downloaders of the availablility of new tasks
|
||||||
for _, ch := range []chan bool{d.bodyWakeCh, d.receiptWakeCh} {
|
for _, ch := range []chan bool{d.bodyWakeCh, d.receiptWakeCh} {
|
||||||
select {
|
select {
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ func (s *PublicEthereumAPI) Syncing() (interface{}, error) {
|
||||||
progress := s.b.Downloader().Progress()
|
progress := s.b.Downloader().Progress()
|
||||||
|
|
||||||
// Return not syncing if the synchronisation already completed
|
// Return not syncing if the synchronisation already completed
|
||||||
if progress.CurrentBlock >= progress.HighestBlock {
|
if !s.b.Downloader().Synchronising() {
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
// Otherwise gather the block sync stats
|
// Otherwise gather the block sync stats
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue