mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-23 11:57:18 +00:00
Check for syncstatus before performing a voluntary exit (#9951)
Co-authored-by: Radosław Kapka <rkapka@wp.pl>
This commit is contained in:
parent
d8aa0f8827
commit
71d55d1cff
@ -54,6 +54,7 @@ go_library(
|
||||
"@com_github_urfave_cli_v2//:go_default_library",
|
||||
"@com_github_wealdtech_go_eth2_wallet_encryptor_keystorev4//:go_default_library",
|
||||
"@org_golang_google_grpc//:go_default_library",
|
||||
"@org_golang_google_protobuf//types/known/emptypb:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -24,6 +24,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/validator/keymanager"
|
||||
"github.com/urfave/cli/v2"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
|
||||
// PerformExitCfg for account voluntary exits.
|
||||
@ -57,6 +58,20 @@ func ExitAccountsCli(cliCtx *cli.Context, r io.Reader) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if nodeClient == nil {
|
||||
return errors.New("Could not prepare beacon node client")
|
||||
}
|
||||
syncStatus, err := (*nodeClient).GetSyncStatus(cliCtx.Context, &emptypb.Empty{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if syncStatus == nil {
|
||||
return errors.New("Could not get sync status")
|
||||
}
|
||||
|
||||
if (*syncStatus).Syncing {
|
||||
return errors.New("Could not perform exit: beacon node is syncing.")
|
||||
}
|
||||
|
||||
cfg := PerformExitCfg{
|
||||
*validatorClient,
|
||||
|
Loading…
Reference in New Issue
Block a user