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`
This commit is contained in:
maskpp 2024-09-24 15:26:29 +08:00 committed by GitHub
parent 564b616163
commit 2278647ef2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -302,6 +302,10 @@ func ParseStateScheme(provided string, disk ethdb.Database) (string, error) {
log.Info("State scheme set to already existing", "scheme", stored)
return stored, nil // reuse scheme of persistent scheme
}
// If state scheme is specified, ensure it's valid.
if provided != HashScheme && provided != PathScheme {
return "", fmt.Errorf("invalid state scheme %s", provided)
}
// If state scheme is specified, ensure it's compatible with
// persistent state.
if stored == "" || provided == stored {