Skip to content

Commit ea04ad0

Browse files
committed
eth: update higest block we know during the sync if a higher was found
1 parent 3ec1b9a commit ea04ad0

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

eth/downloader/downloader.go

+8
Original file line numberDiff line numberDiff line change
@@ -1296,6 +1296,14 @@ func (d *Downloader) processHeaders(origin uint64, pivot uint64, td *big.Int) er
12961296
headers = headers[limit:]
12971297
origin += uint64(limit)
12981298
}
1299+
1300+
// Update the highest block number we know if a higher one is found.
1301+
d.syncStatsLock.Lock()
1302+
if d.syncStatsChainHeight < origin {
1303+
d.syncStatsChainHeight = origin
1304+
}
1305+
d.syncStatsLock.Unlock()
1306+
12991307
// Signal the content downloaders of the availablility of new tasks
13001308
for _, ch := range []chan bool{d.bodyWakeCh, d.receiptWakeCh} {
13011309
select {

internal/ethapi/api.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func (s *PublicEthereumAPI) Syncing() (interface{}, error) {
8080
progress := s.b.Downloader().Progress()
8181

8282
// Return not syncing if the synchronisation already completed
83-
if progress.CurrentBlock >= progress.HighestBlock {
83+
if !s.b.Downloader().Synchronising() {
8484
return false, nil
8585
}
8686
// Otherwise gather the block sync stats

0 commit comments

Comments
 (0)