From 0ed265c5e0a75fbf12d30dc7642c025e68d7cfbf Mon Sep 17 00:00:00 2001 From: zjubfd <296179868@qq.com> Date: Mon, 25 Jul 2022 21:12:45 +0800 Subject: [PATCH] fix: fast node can not recover from force kill or panic (#1014) --- core/blockchain_reader.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/blockchain_reader.go b/core/blockchain_reader.go index 7417ce8b7..b28661da3 100644 --- a/core/blockchain_reader.go +++ b/core/blockchain_reader.go @@ -258,6 +258,9 @@ func (bc *BlockChain) GetTd(hash common.Hash, number uint64) *big.Int { // HasState checks if state trie is fully present in the database or not. func (bc *BlockChain) HasState(hash common.Hash) bool { + if bc.stateCache.NoTries() { + return bc.snaps != nil && bc.snaps.Snapshot(hash) != nil + } if bc.pipeCommit && bc.snaps != nil { // If parent snap is pending on verification, treat it as state exist if s := bc.snaps.Snapshot(hash); s != nil && !s.Verified() {