Skip to content

Commit

Permalink
resolve keefe's comment
Browse files Browse the repository at this point in the history
  • Loading branch information
unclezoro committed Jan 20, 2022
1 parent 8913b09 commit 6299c90
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 2 additions & 0 deletions core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,8 @@ func (bc *BlockChain) tryRewindBadBlocks() {
log.Warn("current block verified failed, rewind to its parent", "height", block.NumberU64(), "hash", block.Hash())
bc.futureBlocks.Remove(block.Hash())
bc.badBlockCache.Add(block.Hash(), time.Now())
bc.diffLayerCache.Remove(block.Hash())
bc.diffLayerRLPCache.Remove(block.Hash())
bc.reportBlock(block, nil, errStateRootVerificationFailed)
bc.setHeadBeyondRoot(block.NumberU64()-1, common.Hash{})
}
Expand Down
5 changes: 1 addition & 4 deletions core/state/statedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,7 @@ func newStateDB(root common.Hash, db Database, snaps *snapshot.Tree) (*StateDB,
tr, err := db.OpenTrie(root)
// return error when 1. failed to open trie and 2. the snap is not nil and done verification
if err != nil && (sdb.snap == nil || snapVerified) {
if err != nil {
return nil, err
}
return nil, fmt.Errorf("no available state")
return nil, err
}
sdb.trie = tr
return sdb, nil
Expand Down

0 comments on commit 6299c90

Please sign in to comment.