mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-10 11:41:21 +00:00
77d3ccb9ad
* Clean up state types * rename package
29 lines
988 B
Go
29 lines
988 B
Go
package validator
|
|
|
|
import (
|
|
"github.com/prysmaticlabs/prysm/v3/beacon-chain/core/blocks"
|
|
"github.com/prysmaticlabs/prysm/v3/beacon-chain/state"
|
|
"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 primitives.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
|
|
}
|