Force manual validator account creation (#6165)

* Force manual validator account creation

* Fix

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
Ivan Martinez
2020-06-08 10:03:14 -04:00
committed by GitHub
parent 8ffe9858ec
commit cb2813fa05
2 changed files with 8 additions and 9 deletions

View File

@@ -2,6 +2,7 @@ package keymanager
import (
"encoding/json"
"errors"
"os"
"strings"
@@ -53,13 +54,7 @@ func NewKeystore(input string) (KeyManager, string, error) {
if err != nil {
return nil, keystoreOptsHelp, err
}
if !exists {
// If an account does not exist, we create a new one and start the node.
opts.Path, opts.Passphrase, err = accounts.CreateValidatorAccount(opts.Path, opts.Passphrase)
if err != nil {
return nil, keystoreOptsHelp, err
}
} else {
if exists {
if opts.Passphrase == "" {
log.Info("Enter your validator account password:")
bytePassword, err := terminal.ReadPassword(int(os.Stdin.Fd()))
@@ -73,6 +68,8 @@ func NewKeystore(input string) (KeyManager, string, error) {
if err := accounts.VerifyAccountNotExists(opts.Path, opts.Passphrase); err == nil {
log.Info("No account found, creating new validator account...")
}
} else {
return nil, "", errors.New("no validator keys found, please use validator accounts create")
}
keyMap, err := accounts.DecryptKeysFromKeystore(opts.Path, params.BeaconConfig().ValidatorPrivkeyFileName, opts.Passphrase)