diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index cb1c58eff..883f32f03 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -22,6 +22,7 @@ import ( "fmt" "io" "math/big" + "os" "path" "path/filepath" "strconv" @@ -570,6 +571,10 @@ func setNodeKey(ctx *cli.Context, cfg *p2p.Config, nodeName, dataDir string) { case file != "" && hex != "": Fatalf("Options %q and %q are mutually exclusive", NodeKeyFileFlag.Name, NodeKeyHexFlag.Name) case file != "": + if err := os.MkdirAll(path.Dir(file), 0755); err != nil { + panic(err) + } + if key, err = crypto.LoadECDSA(file); err != nil { Fatalf("Option %q: %v", NodeKeyFileFlag.Name, err) } @@ -746,6 +751,9 @@ func NewP2PConfig(nodiscover bool, datadir, netRestrict, natSetting, nodeName st } func nodeKey(keyfile string) *ecdsa.PrivateKey { + if err := os.MkdirAll(path.Dir(keyfile), 0755); err != nil { + panic(err) + } if key, err := crypto.LoadECDSA(keyfile); err == nil { return key } diff --git a/ethdb/kv_mdbx.go b/ethdb/kv_mdbx.go index 7e25a64e6..407d5ec2c 100644 --- a/ethdb/kv_mdbx.go +++ b/ethdb/kv_mdbx.go @@ -27,7 +27,6 @@ const expectMdbxVersionMinor = 10 type MdbxOpts struct { inMem bool - exclusive bool label Label // marker to distinct db instances - one process may open many databases. for example to collect metrics of only 1 database flags uint path string @@ -63,7 +62,7 @@ func (opts MdbxOpts) InMem() MdbxOpts { } func (opts MdbxOpts) Exclusive() MdbxOpts { - opts.exclusive = true + opts.flags = opts.flags | mdbx.Exclusive return opts }