Move voluntary exit logging to accounts_exit (#7603)

Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
This commit is contained in:
Radosław Kapka 2020-10-22 17:01:11 +02:00 committed by GitHub
parent ddbece5988
commit 17a08a75ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 8 deletions

View File

@ -8,6 +8,7 @@ import (
"github.com/pkg/errors"
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
"github.com/prysmaticlabs/prysm/beacon-chain/core/blocks"
"github.com/prysmaticlabs/prysm/shared/bytesutil"
"github.com/prysmaticlabs/prysm/shared/cmd"
"github.com/prysmaticlabs/prysm/shared/promptutil"
@ -195,7 +196,14 @@ func performExit(cliCtx *cli.Context, cfg performExitCfg) ([]string, error) {
for i, key := range cfg.rawPubKeys {
if err := client.ProposeExit(cliCtx.Context, cfg.validatorClient, cfg.nodeClient, cfg.keymanager.Sign, key); err != nil {
rawNotExitedKeys = append(rawNotExitedKeys, key)
log.WithError(err).Errorf("voluntary exit failed for account %s", cfg.formattedPubKeys[i])
msg := err.Error()
if strings.Contains(msg, blocks.ValidatorAlreadyExitedMsg) ||
strings.Contains(msg, blocks.ValidatorCannotExitYetMsg) {
log.Warningf("Could not perform voluntary exit for account %s: %s", cfg.formattedPubKeys[i], msg)
} else {
log.WithError(err).Errorf("voluntary exit failed for account %s", cfg.formattedPubKeys[i])
}
}
}
var formattedExitedKeys []string

View File

@ -2,9 +2,7 @@ package accounts
import (
"os"
"strings"
"github.com/prysmaticlabs/prysm/beacon-chain/core/blocks"
"github.com/prysmaticlabs/prysm/shared/cmd"
"github.com/prysmaticlabs/prysm/shared/featureconfig"
"github.com/prysmaticlabs/prysm/shared/tos"
@ -198,11 +196,6 @@ this command outputs a deposit data string which is required to become a validat
Action: func(cliCtx *cli.Context) error {
featureconfig.ConfigureValidator(cliCtx)
if err := ExitAccountsCli(cliCtx, os.Stdin); err != nil {
msg := err.Error()
if strings.Contains(msg, blocks.ValidatorAlreadyExitedMsg) ||
strings.Contains(msg, blocks.ValidatorCannotExitYetMsg) {
log.Errorf("Could not perform voluntary exit: %s", msg)
}
log.Fatalf("Could not perform voluntary exit: %v", err)
}
return nil