mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-03 09:37:38 +00:00
create dir for node keyfile (#2161)
This commit is contained in:
parent
229d6671b9
commit
b79823d1b9
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user