Skip to content

Commit

Permalink
core/rawdb: improve state scheme checking (#28724)
Browse files Browse the repository at this point in the history
This pull request improves the condition to check if path state scheme is in use. 

Originally, root node presence was used as the indicator if path scheme is used or not. However due to fact that root node will be deleted during the initial snap sync, this condition is no longer useful.

If PersistentStateID is present, it shows that we've already configured for path scheme.
  • Loading branch information
rjl493456442 authored and Francesco4203 committed Nov 5, 2024
1 parent 95e34d7 commit 399e29d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions core/rawdb/accessors_trie.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,11 @@ func ReadStateScheme(db ethdb.Reader) string {
if len(blob) != 0 {
return PathScheme
}
// The root node might be deleted during the initial snap sync, check
// the persistent state id then.
if id := ReadPersistentStateID(db); id != 0 {
return PathScheme
}
// In a hash-based scheme, the genesis state is consistently stored
// on the disk. To assess the scheme of the persistent state, it
// suffices to inspect the scheme of the genesis state.
Expand Down

0 comments on commit 399e29d

Please sign in to comment.