Merge branch 'eip4844' of github.com:prysmaticlabs/prysm into eip4844

This commit is contained in:
terence tsao
2023-01-24 11:41:40 +01:00

View File

@@ -214,10 +214,15 @@ func (s *Service) processPendingBlocks(ctx context.Context) error {
s.setSeenBlockIndexSlot(b.Block().Slot(), b.Block().ProposerIndex())
// Broadcasting the block again once a node is able to process it.
pb, err := b.Proto()
if err != nil {
log.WithError(err).Debug("Could not get protobuf block")
if slots.ToEpoch(slot) >= params.BeaconConfig().DenebForkEpoch {
if err := s.broadcastBlockAndBlobsSidecar(ctx, b, blobs[i]); err != nil {
log.WithError(err).Debug("Could not broadcast block and blobs sidecar")
}
} else {
pb, err := b.Proto()
if err != nil {
log.WithError(err).Debug("Could not get protobuf block")
}
if err := s.cfg.p2p.Broadcast(ctx, pb); err != nil {
log.WithError(err).Debug("Could not broadcast block")
}
@@ -242,6 +247,18 @@ func (s *Service) processPendingBlocks(ctx context.Context) error {
return s.sendBatchRootRequest(ctx, parentRoots, randGen)
}
func (s *Service) broadcastBlockAndBlobsSidecar(ctx context.Context, b interfaces.SignedBeaconBlock, blobs *ethpb.BlobsSidecar) error {
blkPb, err := b.PbDenebBlock()
if err != nil {
return err
}
pb := &ethpb.SignedBeaconBlockAndBlobsSidecar{
BeaconBlock: blkPb,
BlobsSidecar: blobs,
}
return s.cfg.p2p.Broadcast(ctx, pb)
}
func (s *Service) checkIfBlockIsBad(
ctx context.Context,
span *trace.Span,