679 }
680}
681
682func (s *Service) handleInvalidExecutionError(ctx context.Context, err error, blockRoot [32]byte, parentRoot [32]byte) error {683 if IsInvalidBlock(err) && InvalidBlockLVH(err) != [32]byte{} {
684 return s.pruneInvalidBlock(ctx, blockRoot, parentRoot, InvalidBlockLVH(err))
685 }
137type reqOption func(*http.Request)
138
139// do is a generic, opinionated request function to reduce boilerplate amongst the methods in this package api/client/builder.
140func (c *Client) do(ctx context.Context, method string, path string, body io.Reader, opts ...reqOption) (res []byte, err error) {141 ctx, span := trace.StartSpan(ctx, "builder.client.do")
142 defer func() {
143 tracing.AnnotateError(span, err)
57}
58
59// BuildBlobSidecars given a block, builds the blob sidecars for the block.
60func BuildBlobSidecars(blk interfaces.SignedBeaconBlock, blobs [][]byte, kzgProofs [][]byte) ([]*ethpb.BlobSidecar, error) {61 if blk.Version() < version.Deneb {
62 return nil, nil // No blobs before deneb.
63 }
376
377// This saves the Attestations and BLSToExecChanges between `orphanedRoot` and the common ancestor root that is derived using `newHeadRoot`.
378// It also filters out the attestations that is one epoch older as a defense so invalid attestations don't flow into the attestation pool.
379func (s *Service) saveOrphanedOperations(ctx context.Context, orphanedRoot [32]byte, newHeadRoot [32]byte) error {380 commonAncestorRoot, _, err := s.cfg.ForkChoiceStore.CommonAncestor(ctx, newHeadRoot, orphanedRoot)
381 switch {
382 // Exit early if there's no common ancestor and root doesn't exist, there would be nothing to save.
358 return nil
359}
360
361func (s *Service) processBlockInBatch(ctx context.Context, currentBlockNum uint64, latestFollowHeight uint64, batchSize uint64, additiveFactor uint64, logCount uint64, headersMap map[uint64]*types.HeaderInfo) (uint64, uint64, error) {362 // Batch request the desired headers and store them in a
363 // map for quick access.
364 requestHeaders := func(startBlk uint64, endBlk uint64) error {
If parameters of the same type lie consecutively, mention their type once at the end of the last parameter.
Unlike other languages, like C, where all parameters must be specified with types explicitly, it is not required to do so in Go. Combining the types is usually recommended for the sake of brevity.
func foo(a, b int, c, d int, e, f int, g int) {}
func foo(a, b, c, d, e, f, g int) {}