diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index db5964d75..5d5f559b6 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -1195,11 +1195,10 @@ func SetNodeConfigCobra(cmd *cobra.Command, cfg *nodecfg.Config) { func setDataDir(ctx *cli.Context, cfg *nodecfg.Config) { if ctx.IsSet(DataDirFlag.Name) { - cfg.Dirs.DataDir = ctx.String(DataDirFlag.Name) + cfg.Dirs = datadir.New(ctx.String(DataDirFlag.Name)) } else { - cfg.Dirs.DataDir = paths.DataDirForNetwork(cfg.Dirs.DataDir, ctx.String(ChainFlag.Name)) + cfg.Dirs = datadir.New(paths.DataDirForNetwork(paths.DefaultDataDir(), ctx.String(ChainFlag.Name))) } - cfg.Dirs = datadir.New(cfg.Dirs.DataDir) cfg.MdbxPageSize = flags.DBPageSizeFlagUnmarshal(ctx, DbPageSizeFlag.Name, DbPageSizeFlag.Usage) if err := cfg.MdbxDBSizeLimit.UnmarshalText([]byte(ctx.String(DbSizeLimitFlag.Name))); err != nil { panic(err) @@ -1220,13 +1219,10 @@ func setDataDirCobra(f *pflag.FlagSet, cfg *nodecfg.Config) { panic(err) } if dirname != "" { - cfg.Dirs.DataDir = dirname + cfg.Dirs = datadir.New(dirname) } else { - cfg.Dirs.DataDir = paths.DataDirForNetwork(cfg.Dirs.DataDir, chain) + cfg.Dirs = datadir.New(paths.DataDirForNetwork(paths.DefaultDataDir(), chain)) } - - cfg.Dirs.DataDir = paths.DataDirForNetwork(cfg.Dirs.DataDir, chain) - cfg.Dirs = datadir.New(cfg.Dirs.DataDir) } func setGPO(ctx *cli.Context, cfg *gaspricecfg.Config) { diff --git a/node/nodecfg/defaults.go b/node/nodecfg/defaults.go index 7ba748370..da16d7ab9 100644 --- a/node/nodecfg/defaults.go +++ b/node/nodecfg/defaults.go @@ -17,10 +17,8 @@ package nodecfg import ( - "github.com/ledgerwatch/erigon-lib/common/datadir" "github.com/ledgerwatch/erigon-lib/direct" - "github.com/ledgerwatch/erigon/common/paths" "github.com/ledgerwatch/erigon/p2p" "github.com/ledgerwatch/erigon/p2p/nat" "github.com/ledgerwatch/erigon/rpc/rpccfg" @@ -40,7 +38,6 @@ const ( // DefaultConfig contains reasonable default settings. var DefaultConfig = Config{ - Dirs: datadir.New(paths.DefaultDataDir()), HTTPPort: DefaultHTTPPort, HTTPModules: []string{"net", "web3"}, HTTPVirtualHosts: []string{"localhost"},