|
|
@ -524,8 +524,13 @@ func (bc *BlockChain) SetHeadBeyondRoot(head uint64, root common.Hash) (uint64, |
|
|
|
if _, err := state.New(newHeadBlock.Root(), bc.stateCache, bc.snaps); err != nil { |
|
|
|
if _, err := state.New(newHeadBlock.Root(), bc.stateCache, bc.snaps); err != nil { |
|
|
|
log.Trace("Block state missing, rewinding further", "number", newHeadBlock.NumberU64(), "hash", newHeadBlock.Hash()) |
|
|
|
log.Trace("Block state missing, rewinding further", "number", newHeadBlock.NumberU64(), "hash", newHeadBlock.Hash()) |
|
|
|
if pivot == nil || newHeadBlock.NumberU64() > *pivot { |
|
|
|
if pivot == nil || newHeadBlock.NumberU64() > *pivot { |
|
|
|
newHeadBlock = bc.GetBlock(newHeadBlock.ParentHash(), newHeadBlock.NumberU64()-1) |
|
|
|
parent := bc.GetBlock(newHeadBlock.ParentHash(), newHeadBlock.NumberU64()-1) |
|
|
|
continue |
|
|
|
if parent != nil { |
|
|
|
|
|
|
|
newHeadBlock = parent |
|
|
|
|
|
|
|
continue |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
log.Error("Missing block in the middle, aiming genesis", "number", newHeadBlock.NumberU64()-1, "hash", newHeadBlock.ParentHash()) |
|
|
|
|
|
|
|
newHeadBlock = bc.genesisBlock |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
log.Trace("Rewind passed pivot, aiming genesis", "number", newHeadBlock.NumberU64(), "hash", newHeadBlock.Hash(), "pivot", *pivot) |
|
|
|
log.Trace("Rewind passed pivot, aiming genesis", "number", newHeadBlock.NumberU64(), "hash", newHeadBlock.Hash(), "pivot", *pivot) |
|
|
|
newHeadBlock = bc.genesisBlock |
|
|
|
newHeadBlock = bc.genesisBlock |
|
|
|