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

30 lines
973 B
Go
Raw Normal View History

2023-01-13 23:45:17 +00:00
package validator
import (
"github.com/prysmaticlabs/prysm/v4/beacon-chain/state"
"github.com/prysmaticlabs/prysm/v4/consensus-types/interfaces"
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/v4/runtime/version"
2023-01-13 23:45:17 +00:00
)
// Sets the bls to exec data for a block.
2023-02-09 09:23:32 +00:00
func (vs *Server) setBlsToExecData(blk interfaces.SignedBeaconBlock, headState state.BeaconState) {
2023-01-13 23:45:17 +00:00
if blk.Version() < version.Capella {
return
}
if err := blk.SetBLSToExecutionChanges([]*ethpb.SignedBLSToExecutionChange{}); err != nil {
2023-01-13 23:45:17 +00:00
log.WithError(err).Error("Could not set bls to execution data in block")
return
}
changes, err := vs.BLSChangesPool.BLSToExecChangesForInclusion(headState)
if err != nil {
log.WithError(err).Error("Could not get bls to execution changes")
return
} else {
if err := blk.SetBLSToExecutionChanges(changes); err != nil {
2023-01-13 23:45:17 +00:00
log.WithError(err).Error("Could not set bls to execution changes")
return
}
}
}