Move statediff on/off check to geth cmd config

This commit is contained in:
Elizabeth Engelman 2018-11-29 11:05:00 -06:00
parent 32a0a23821
commit 70d531dc1e
3 changed files with 4 additions and 15 deletions

View File

@ -178,6 +178,10 @@ func makeFullNode(ctx *cli.Context) *node.Node {
if cfg.Ethstats.URL != "" {
utils.RegisterEthStatsService(stack, cfg.Ethstats.URL)
}
if ctx.GlobalBool(utils.StateDiffFlag.Name) {
utils.RegisterStateDiffService(stack)
}
return stack
}

View File

@ -1134,13 +1134,6 @@ func SetShhConfig(ctx *cli.Context, stack *node.Node, cfg *whisper.Config) {
}
}
// Check if state diff flags are on and applies them to eth context
func setStateDiff(ctx *cli.Context, cfg *eth.Config) {
if ctx.GlobalBool(StateDiffFlag.Name) && cfg.NoPruning && cfg.SyncMode == downloader.FullSync {
cfg.StateDiff.On = true
}
}
// SetEthConfig applies eth-related command line flags to the config.
func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) {
// Avoid conflicting network flags
@ -1176,10 +1169,6 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) {
}
cfg.NoPruning = ctx.GlobalString(GCModeFlag.Name) == "archive"
if ctx.GlobalIsSet(StateDiffFlag.Name) {
setStateDiff(ctx, cfg)
}
if ctx.GlobalIsSet(CacheFlag.Name) || ctx.GlobalIsSet(CacheTrieFlag.Name) {
cfg.TrieCleanCache = ctx.GlobalInt(CacheFlag.Name) * ctx.GlobalInt(CacheTrieFlag.Name) / 100
}

View File

@ -17,7 +17,6 @@
package eth
import (
"github.com/ethereum/go-ethereum/statediff"
"math/big"
"os"
"os/user"
@ -129,9 +128,6 @@ type Config struct {
EWASMInterpreter string
// Type of the EVM interpreter ("" for default)
EVMInterpreter string
// Config for state diff building
StateDiff statediff.Config
}
type configMarshaling struct {