aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/geth/accountcmd.go
diff options
context:
space:
mode:
authorYondon Fu <yondon.fu@gmail.com>2017-12-19 06:17:41 +0800
committerYondon Fu <yondon.fu@gmail.com>2017-12-19 06:17:41 +0800
commit3857cdc267e3192697f561df0a0f827f65dfb6b5 (patch)
tree401c52c4972a68229ea283a394a0b0a5f3cfdc8e /cmd/geth/accountcmd.go
parenta5330fe0c569b75cb8a524f60f7e8dc06498262b (diff)
parentfe070ab5c32702033489f1b9d1655ea1b894c29e (diff)
downloaddexon-3857cdc267e3192697f561df0a0f827f65dfb6b5.tar
dexon-3857cdc267e3192697f561df0a0f827f65dfb6b5.tar.gz
dexon-3857cdc267e3192697f561df0a0f827f65dfb6b5.tar.bz2
dexon-3857cdc267e3192697f561df0a0f827f65dfb6b5.tar.lz
dexon-3857cdc267e3192697f561df0a0f827f65dfb6b5.tar.xz
dexon-3857cdc267e3192697f561df0a0f827f65dfb6b5.tar.zst
dexon-3857cdc267e3192697f561df0a0f827f65dfb6b5.zip
Merge branch 'master' into abi-offset-fixed-arrays
Diffstat (limited to 'cmd/geth/accountcmd.go')
-rw-r--r--cmd/geth/accountcmd.go21
1 files changed, 17 insertions, 4 deletions
diff --git a/cmd/geth/accountcmd.go b/cmd/geth/accountcmd.go
index 0f53c92b0..0db5c4ce0 100644
--- a/cmd/geth/accountcmd.go
+++ b/cmd/geth/accountcmd.go
@@ -291,15 +291,28 @@ func ambiguousAddrRecovery(ks *keystore.KeyStore, err *keystore.AmbiguousAddrErr
// accountCreate creates a new account into the keystore defined by the CLI flags.
func accountCreate(ctx *cli.Context) error {
- stack, _ := makeConfigNode(ctx)
+ cfg := gethConfig{Node: defaultNodeConfig()}
+ // Load config file.
+ if file := ctx.GlobalString(configFileFlag.Name); file != "" {
+ if err := loadConfig(file, &cfg); err != nil {
+ utils.Fatalf("%v", err)
+ }
+ }
+ utils.SetNodeConfig(ctx, &cfg.Node)
+ scryptN, scryptP, keydir, err := cfg.Node.AccountConfig()
+
+ if err != nil {
+ utils.Fatalf("Failed to read configuration: %v", err)
+ }
+
password := getPassPhrase("Your new account is locked with a password. Please give a password. Do not forget this password.", true, 0, utils.MakePasswordList(ctx))
- ks := stack.AccountManager().Backends(keystore.KeyStoreType)[0].(*keystore.KeyStore)
- account, err := ks.NewAccount(password)
+ address, err := keystore.StoreKey(keydir, password, scryptN, scryptP)
+
if err != nil {
utils.Fatalf("Failed to create account: %v", err)
}
- fmt.Printf("Address: {%x}\n", account.Address)
+ fmt.Printf("Address: {%x}\n", address)
return nil
}