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`
pull/30503/head
maskpp 2 months ago committed by GitHub
parent 564b616163
commit 2278647ef2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      core/rawdb/accessors_trie.go

@ -302,6 +302,10 @@ func ParseStateScheme(provided string, disk ethdb.Database) (string, error) {
log.Info("State scheme set to already existing", "scheme", stored) log.Info("State scheme set to already existing", "scheme", stored)
return stored, nil // reuse scheme of persistent scheme 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 // If state scheme is specified, ensure it's compatible with
// persistent state. // persistent state.
if stored == "" || provided == stored { if stored == "" || provided == stored {

Loading…
Cancel
Save