eth: fix corner case in sync head determination (#21695)

This avoids synchronisation failures when the local header is ahead of
the local full block.
This commit is contained in:
Zou Guangxian 2021-03-27 01:06:25 +08:00 committed by GitHub
parent 6477ea6502
commit 955727181b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -289,8 +289,8 @@ func (cs *chainSyncer) modeAndLocalHead() (downloader.SyncMode, *big.Int) {
}
}
// Nope, we're really full syncing
head := cs.handler.chain.CurrentHeader()
td := cs.handler.chain.GetTd(head.Hash(), head.Number.Uint64())
head := cs.handler.chain.CurrentBlock()
td := cs.handler.chain.GetTd(head.Hash(), head.NumberU64())
return downloader.FullSync, td
}