core/blockchain: remove excessive check

This commit removes unnecessary check during rewinding procedure.
While the excessive check does help with clarity, related variables
are nearby this check to aid with readablity.
This commit is contained in:
Hyunchel Kim 2023-10-09 20:18:24 -04:00
parent 4e1e37323d
commit 3d5ba82581
No known key found for this signature in database
GPG key ID: 0436BF9838B5CCC5

View file

@ -672,8 +672,8 @@ func (bc *BlockChain) setHeadBeyondRoot(head uint64, time uint64, root common.Ha
beyondRoot := (root == common.Hash{}) // Flag whether we're beyond the requested root (no root, always true) beyondRoot := (root == common.Hash{}) // Flag whether we're beyond the requested root (no root, always true)
for { for {
// If a root threshold was requested but not yet crossed, check // Check if the root threshold is crossed
if root != (common.Hash{}) && !beyondRoot && newHeadBlock.Root() == root { if !beyondRoot && newHeadBlock.Root() == root {
beyondRoot, rootNumber = true, newHeadBlock.NumberU64() beyondRoot, rootNumber = true, newHeadBlock.NumberU64()
} }
if !bc.HasState(newHeadBlock.Root()) && !bc.stateRecoverable(newHeadBlock.Root()) { if !bc.HasState(newHeadBlock.Root()) && !bc.stateRecoverable(newHeadBlock.Root()) {