Skip to content

Commit f469470

Browse files
authored
core/rawdb: improve state scheme checking (#28724)
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.
1 parent cca9479 commit f469470

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

core/rawdb/accessors_trie.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,11 @@ func ReadStateScheme(db ethdb.Reader) string {
292292
if len(blob) != 0 {
293293
return PathScheme
294294
}
295+
// The root node might be deleted during the initial snap sync, check
296+
// the persistent state id then.
297+
if id := ReadPersistentStateID(db); id != 0 {
298+
return PathScheme
299+
}
295300
// In a hash-based scheme, the genesis state is consistently stored
296301
// on the disk. To assess the scheme of the persistent state, it
297302
// suffices to inspect the scheme of the genesis state.

0 commit comments

Comments
 (0)