validator/accounts: don't ask for keystore path if specified (#5641)

* validator/accounts: don't ask for keystore path of specified
* Merge branch 'master' into master
* Merge branch 'master' into master
* validator/accounts restore new validator account creation
* Merge branch 'master' into master
This commit is contained in:
Raw Pong Ghmoa 2020-04-27 18:26:51 +02:00 committed by GitHub
parent f70635a992
commit f19aa93de2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -149,18 +149,17 @@ func CreateValidatorAccount(path string, passphrase string) (string, string, err
if path == "" {
path = DefaultValidatorDir()
log.Infof("Please specify a keystore path to save your private keys (default: %q):", path)
reader := bufio.NewReader(os.Stdin)
text, err := reader.ReadString('\n')
if err != nil {
log.Fatal(err)
return path, passphrase, err
}
if text = strings.Replace(text, "\n", "", -1); text != "" {
path = text
}
}
log.Infof("Keystore path to save your private keys (default: %q):", path)
reader := bufio.NewReader(os.Stdin)
text, err := reader.ReadString('\n')
if err != nil {
log.Fatal(err)
return path, passphrase, err
}
if text = strings.Replace(text, "\n", "", -1); text != "" {
path = text
}
if err := NewValidatorAccount(path, passphrase); err != nil {
return "", "", errors.Wrapf(err, "could not initialize validator account")
}