aboutsummaryrefslogtreecommitdiffstats
path: root/node
diff options
context:
space:
mode:
authorMartin Holst Swende <martin@swende.se>2017-11-21 00:39:53 +0800
committerFelix Lange <fjl@users.noreply.github.com>2017-11-21 00:39:53 +0800
commitbedf6f40aff0dd14bfab533a37c329ddc9a4bdd5 (patch)
tree69450c1c69b418ad9040d58cf9d2e2584bd27e07 /node
parentb4f2e4de8fcbaab22f1b8ac1faa0c99517bd9405 (diff)
downloadgo-tangerine-bedf6f40aff0dd14bfab533a37c329ddc9a4bdd5.tar.gz
go-tangerine-bedf6f40aff0dd14bfab533a37c329ddc9a4bdd5.tar.zst
go-tangerine-bedf6f40aff0dd14bfab533a37c329ddc9a4bdd5.zip
cmd/geth: make geth account new faster with many keys (#15529)
Diffstat (limited to 'node')
-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
}