2023-01-16 15:00:11 +00:00
|
|
|
package sync
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/pkg/errors"
|
|
|
|
"github.com/prysmaticlabs/prysm/v3/config/params"
|
|
|
|
types "github.com/prysmaticlabs/prysm/v3/consensus-types/primitives"
|
|
|
|
"github.com/prysmaticlabs/prysm/v3/time/slots"
|
|
|
|
)
|
|
|
|
|
|
|
|
// This routine broadcasts all known BLS changes at the Capella fork.
|
|
|
|
func (s *Service) broadcastBLSChanges(currSlot types.Slot) error {
|
|
|
|
capellaSlotStart, err := slots.EpochStart(params.BeaconConfig().CapellaForkEpoch)
|
|
|
|
if err != nil {
|
2023-01-17 10:59:51 +00:00
|
|
|
// only possible error is an overflow, so we exit early from the method
|
|
|
|
return nil
|
2023-01-16 15:00:11 +00:00
|
|
|
}
|
|
|
|
if currSlot == capellaSlotStart {
|
|
|
|
changes, err := s.cfg.blsToExecPool.PendingBLSToExecChanges()
|
|
|
|
if err != nil {
|
|
|
|
return errors.Wrap(err, "could not get BLS to execution changes")
|
|
|
|
}
|
|
|
|
for _, ch := range changes {
|
|
|
|
if err := s.cfg.p2p.Broadcast(s.ctx, ch); err != nil {
|
|
|
|
return errors.Wrap(err, "could not broadcast BLS to execution changes.")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|