-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/geth: add check func to validate state scheme #2067
Conversation
50c4e45
to
f2dc7a5
Compare
LGTM |
f2dc7a5
to
e1aae7b
Compare
// there is no persistent state data in disk db(e.g. geth init) | ||
if !ctx.IsSet(StateSchemeFlag.Name) { | ||
log.Info("State scheme set by config", "scheme", stateSchemeCfg) | ||
return stateSchemeCfg, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need judge if the stateSchemeCfg is not setted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stateSchemeCfg
is impossible to be empty in ResolveStateScheme
function, because there is a default value in caller function loadBaseConfig
.
} | ||
if !ctx.IsSet(StateSchemeFlag.Name) { | ||
if stored != stateSchemeCfg { | ||
return "", fmt.Errorf("incompatible state scheme, stored: %s, config: %s", stored, stateSchemeCfg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should not return error if stateSchemeCfg is empty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto. stateSchemeCfg
is impossible to be empty in ResolveStateScheme
function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
Provide explicit for which state scheme geth can use to start or init. And add check function to validate provided state scheme.
Rationale
Users may add
StateScheme = "path"
inconfig.toml
and want to start geth without persistent state in disk, but geth is started inhash
mode. For solving these cases, add a function, obey the following rules:Example
nohup ./geth --config config.toml --cache 8000 --rpc.allow-unprotected-txs --history.transactions 0 >> nohup.out 2>&1&
and addStateScheme = "path"
inconfig.toml
, geth is started inpath
mode.Changes
Notable changes: