mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-21 12:16:44 +00:00
fix: correct finalized invalidation
This commit is contained in:
parent
4d4f224437
commit
1e565ec1f6
1 changed files with 3 additions and 2 deletions
|
|
@ -1105,11 +1105,12 @@ func (bc *BlockChain) setHeadBeyondRoot(head uint64, time uint64, root common.Ha
|
|||
bc.txLookupCache.Purge()
|
||||
|
||||
// Clear safe block, finalized block if needed
|
||||
if safe := bc.CurrentSafeBlock(); safe != nil && rootNumber < safe.Number.Uint64() {
|
||||
headBlock := bc.CurrentBlock()
|
||||
if safe := bc.CurrentSafeBlock(); safe != nil && headBlock.Number.Uint64() < safe.Number.Uint64() {
|
||||
log.Warn("SetHead invalidated safe block")
|
||||
bc.SetSafe(nil)
|
||||
}
|
||||
if finalized := bc.CurrentFinalBlock(); finalized != nil && rootNumber < finalized.Number.Uint64() {
|
||||
if finalized := bc.CurrentFinalBlock(); finalized != nil && headBlock.Number.Uint64() < finalized.Number.Uint64() {
|
||||
log.Error("SetHead invalidated finalized block")
|
||||
bc.SetFinalized(nil)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue