From 4b2f9322c62dd866d458a81e7e78fcf1b46dfd99 Mon Sep 17 00:00:00 2001 From: Justin Brower Date: Tue, 24 Sep 2024 21:02:42 -0400 Subject: [PATCH] fix calculation for finding a stale pod --- cli/core/findStalePods.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cli/core/findStalePods.go b/cli/core/findStalePods.go index cf829fe9..f80070dc 100644 --- a/cli/core/findStalePods.go +++ b/cli/core/findStalePods.go @@ -230,16 +230,20 @@ func FindStaleEigenpods(ctx context.Context, eth *ethclient.Client, nodeUrl stri // - native ETH in the pod // - any active validators and their associated balances // ) - allValidatorsForEigenpod := utils.Filter(allValidatorsWithIndices, func(v ValidatorWithIndex) bool { + allActiveValidatorsForEigenpod := utils.Filter(allValidatorsWithIndices, func(v ValidatorWithIndex) bool { + if allValidatorInfo[v.Index].Status != 1 { + return false + } + withdrawal := executionWithdrawalAddress(v.Validator.WithdrawalCredentials) return withdrawal != nil && strings.EqualFold(*withdrawal, eigenpod) }) - allValidatorBalancesSummedGwei := utils.Reduce(allValidatorsForEigenpod, func(accum phase0.Gwei, validator ValidatorWithIndex) phase0.Gwei { + allActiveValidatorBalancesSummedGwei := utils.Reduce(allActiveValidatorsForEigenpod, func(accum phase0.Gwei, validator ValidatorWithIndex) phase0.Gwei { return accum + allValidatorBalances[validator.Index] }, phase0.Gwei(0)) // converting gwei to wei - allBalances[eigenpod] = cache.PodOwnerShares[eigenpod].ExecutionLayerBalanceWei + (uint64(allValidatorBalancesSummedGwei) * params.GWei) + allBalances[eigenpod] = cache.PodOwnerShares[eigenpod].ExecutionLayerBalanceWei + (uint64(allActiveValidatorBalancesSummedGwei) * params.GWei) return allBalances }, map[string]uint64{})