mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 15:37:56 -05:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user