From 2278647ef2692e6e8f90e4dba429fcc002de16f1 Mon Sep 17 00:00:00 2001 From: maskpp Date: Tue, 24 Sep 2024 15:26:29 +0800 Subject: [PATCH] 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` --- core/rawdb/accessors_trie.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/rawdb/accessors_trie.go b/core/rawdb/accessors_trie.go index 0f856d1804..bfe20767d9 100644 --- a/core/rawdb/accessors_trie.go +++ b/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) 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 {