mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 21:07:18 +00:00
4e28192541
* Proposer RPC: helpers to get exits and slashings * add test Co-authored-by: Nishant Das <nishdas93@gmail.com>
29 lines
989 B
Go
29 lines
989 B
Go
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
|
|
}
|