Skip to content

Commit b75720d

Browse files
authored
core: skip checking state root existence when do snapsync by fast node (ethereum#2258)
1 parent 38d592d commit b75720d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

core/blockchain.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ func NewBlockChain(db ethdb.Database, cacheConfig *CacheConfig, genesis *Genesis
406406
// Make sure the state associated with the block is available, or log out
407407
// if there is no available state, waiting for state sync.
408408
head := bc.CurrentBlock()
409-
if !bc.HasState(head.Root) {
409+
if !bc.NoTries() && !bc.HasState(head.Root) {
410410
if head.Number.Uint64() == 0 {
411411
// The genesis state is missing, which is only possible in the path-based
412412
// scheme. This situation occurs when the initial state sync is not finished
@@ -1011,7 +1011,7 @@ func (bc *BlockChain) SnapSyncCommitHead(hash common.Hash) error {
10111011
return err
10121012
}
10131013
}
1014-
if !bc.HasState(root) {
1014+
if !bc.NoTries() && !bc.HasState(root) {
10151015
return fmt.Errorf("non existent state [%x..]", root[:4])
10161016
}
10171017
// If all checks out, manually set the head block.

0 commit comments

Comments
 (0)