prysm-pulse/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_exits.go

29 lines
989 B
Go
Raw Normal View History

package validator
import (
"github.com/prysmaticlabs/prysm/v3/beacon-chain/core/blocks"
"github.com/prysmaticlabs/prysm/v3/beacon-chain/state"
types "github.com/prysmaticlabs/prysm/v3/consensus-types/primitives"
ethpb "github.com/prysmaticlabs/prysm/v3/proto/prysm/v1alpha1"
)
func (vs *Server) getExits(head state.BeaconState, slot types.Slot) []*ethpb.SignedVoluntaryExit {
exits := vs.ExitPool.PendingExits(head, slot, false /*noLimit*/)
validExits := make([]*ethpb.SignedVoluntaryExit, 0, len(exits))
for _, exit := range exits {
val, err := head.ValidatorAtIndexReadOnly(exit.Exit.ValidatorIndex)
if err != nil {
log.WithError(err).Warn("Could not retrieve validator index")
continue
}
if err := blocks.VerifyExitAndSignature(val, head.Slot(), head.Fork(), exit, head.GenesisValidatorsRoot()); err != nil {
log.WithError(err).Warn("Could not verify exit for block inclusion")
continue
}
validExits = append(validExits, exit)
}
return validExits
}