don't try to create default datadir (#8398)

for https://github.com/ledgerwatch/erigon/issues/8396
This commit is contained in:
Alex Sharov 2023-10-08 08:16:57 +07:00 committed by GitHub
parent d90572b786
commit f7adc2374d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 11 deletions

View File

@ -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) {

View File

@ -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"},