mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 01:43:47 +00:00
internal: fix downloader synchronising judgement
This commit is contained in:
parent
fa375955ad
commit
d5c3458b37
2 changed files with 10 additions and 2 deletions
|
|
@ -253,10 +253,18 @@ func (d *Downloader) Progress() ethereum.SyncProgress {
|
|||
case LightSync:
|
||||
current = d.lightchain.CurrentHeader().Number.Uint64()
|
||||
}
|
||||
|
||||
// If the current block number is greater than the highest block number when synchronization started
|
||||
// due to pivot point moving, using the current block number as a replacement.
|
||||
highest := d.syncStatsChainHeight
|
||||
if current > highest {
|
||||
highest = current
|
||||
}
|
||||
|
||||
return ethereum.SyncProgress{
|
||||
StartingBlock: d.syncStatsChainOrigin,
|
||||
CurrentBlock: current,
|
||||
HighestBlock: d.syncStatsChainHeight,
|
||||
HighestBlock: highest,
|
||||
PulledStates: d.syncStatsState.processed,
|
||||
KnownStates: d.syncStatsState.processed + d.syncStatsState.pending,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ func (s *PublicEthereumAPI) Syncing() (interface{}, error) {
|
|||
progress := s.b.Downloader().Progress()
|
||||
|
||||
// Return not syncing if the synchronisation already completed
|
||||
if progress.CurrentBlock >= progress.HighestBlock {
|
||||
if !s.b.Downloader().Synchronising() {
|
||||
return false, nil
|
||||
}
|
||||
// Otherwise gather the block sync stats
|
||||
|
|
|
|||
Loading…
Reference in a new issue