Skip to content

Commit 2278647

Browse files
authored
core/rawdb: make sure specified state scheme is valid (#30499)
This change exits with error if user provided a `--state.scheme` which is neither `hash` nor `path`
1 parent 564b616 commit 2278647

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

core/rawdb/accessors_trie.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,10 @@ func ParseStateScheme(provided string, disk ethdb.Database) (string, error) {
302302
log.Info("State scheme set to already existing", "scheme", stored)
303303
return stored, nil // reuse scheme of persistent scheme
304304
}
305+
// If state scheme is specified, ensure it's valid.
306+
if provided != HashScheme && provided != PathScheme {
307+
return "", fmt.Errorf("invalid state scheme %s", provided)
308+
}
305309
// If state scheme is specified, ensure it's compatible with
306310
// persistent state.
307311
if stored == "" || provided == stored {

0 commit comments

Comments
 (0)