44 "fmt"
55 "sort"
66
7+ "github.com/rocket-pool/smartnode/shared/services/beacon"
78 "github.com/rocket-pool/smartnode/shared/services/rocketpool"
89 "github.com/rocket-pool/smartnode/shared/types/api"
910 "github.com/rocket-pool/smartnode/shared/utils/cli/color"
@@ -24,22 +25,37 @@ func getExitableValidator() (uint64, bool, error) {
2425 }
2526 defer rp .Close ()
2627
28+ // Get the latest block and identify the withdrawals present in it
29+
30+
2731 // Get Megapool status
2832 status , err := rp .MegapoolStatus (false )
2933 if err != nil {
3034 return 0 , false , err
3135 }
3236
3337 activeValidators := []api.MegapoolValidatorDetails {}
38+ exitingValidators := []api.MegapoolValidatorDetails {}
3439
3540 for _ , validator := range status .Megapool .Validators {
36- if validator .Activated && ! validator .Exiting && ! validator .Exited {
41+ if validator .Activated && ! validator .Exiting && ! validator .Exited && validator . BeaconStatus . Status != beacon . ValidatorState_ActiveExiting {
3742 // Check if validator is old enough to exit
3843 earliestExitEpoch := validator .BeaconStatus .ActivationEpoch + 256
3944 if status .BeaconHead .Epoch >= earliestExitEpoch {
4045 activeValidators = append (activeValidators , validator )
4146 }
4247 }
48+ if validator .BeaconStatus .Status == beacon .ValidatorState_ActiveExiting {
49+ exitingValidators = append (exitingValidators , validator )
50+ }
51+ }
52+ if len (exitingValidators ) > 0 {
53+ sort .Sort (ByIndex (exitingValidators ))
54+ fmt .Println ("The following validators are still active and have already received their exit request on the Beacon Chain:" )
55+ for _ , v := range exitingValidators {
56+ fmt .Printf ("ID %d: - Index %d Pubkey: 0x%s\n " , v .ValidatorId , v .ValidatorIndex , v .PubKey .String ())
57+ }
58+ fmt .Println ()
4359 }
4460 if len (activeValidators ) > 0 {
4561 sort .Sort (ByIndex (activeValidators ))
0 commit comments