aboutsummaryrefslogtreecommitdiffstats
path: root/node/config.go
diff options
context:
space:
mode:
Diffstat (limited to 'node/config.go')
-rw-r--r--node/config.go36
1 files changed, 22 insertions, 14 deletions
diff --git a/node/config.go b/node/config.go
index be9e21b4f..1ee02d896 100644
--- a/node/config.go
+++ b/node/config.go
@@ -360,35 +360,43 @@ func (c *Config) parsePersistentNodes(path string) []*discover.Node {
return nodes
}
-func makeAccountManager(conf *Config) (*accounts.Manager, string, error) {
+// AccountConfig determines the settings for scrypt and keydirectory
+func (c *Config) AccountConfig() (int, int, string, error) {
scryptN := keystore.StandardScryptN
scryptP := keystore.StandardScryptP
- if conf.UseLightweightKDF {
+ if c.UseLightweightKDF {
scryptN = keystore.LightScryptN
scryptP = keystore.LightScryptP
}
var (
- keydir string
- ephemeral string
- err error
+ keydir string
+ err error
)
switch {
- case filepath.IsAbs(conf.KeyStoreDir):
- keydir = conf.KeyStoreDir
- case conf.DataDir != "":
- if conf.KeyStoreDir == "" {
- keydir = filepath.Join(conf.DataDir, datadirDefaultKeyStore)
+ case filepath.IsAbs(c.KeyStoreDir):
+ keydir = c.KeyStoreDir
+ case c.DataDir != "":
+ if c.KeyStoreDir == "" {
+ keydir = filepath.Join(c.DataDir, datadirDefaultKeyStore)
} else {
- keydir, err = filepath.Abs(conf.KeyStoreDir)
+ keydir, err = filepath.Abs(c.KeyStoreDir)
}
- case conf.KeyStoreDir != "":
- keydir, err = filepath.Abs(conf.KeyStoreDir)
- default:
+ case c.KeyStoreDir != "":
+ keydir, err = filepath.Abs(c.KeyStoreDir)
+ }
+ return scryptN, scryptP, keydir, err
+}
+
+func makeAccountManager(conf *Config) (*accounts.Manager, string, error) {
+ scryptN, scryptP, keydir, err := conf.AccountConfig()
+ var ephemeral string
+ if keydir == "" {
// There is no datadir.
keydir, err = ioutil.TempDir("", "go-ethereum-keystore")
ephemeral = keydir
}
+
if err != nil {
return nil, "", err
}