2023-01-13 23:45:17 +00:00
|
|
|
package validator
|
|
|
|
|
|
|
|
import (
|
2023-03-17 18:52:56 +00:00
|
|
|
"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
|
|
|
|
}
|
2023-02-08 16:39:14 +00:00
|
|
|
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 {
|
2023-02-08 16:39:14 +00:00
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|