prysmaticlabs / prysm

Function with cyclomatic complexity higher than threshold GO-R1005
Anti-pattern
Minor
2 occurrences in this check
func getPayloadAttribute has a cyclomatic complexity of 18 with "high" risk
276
277// getPayloadAttribute returns the payload attributes for the given state and slot.
278// The attribute is required to initiate a payload build process in the context of an `engine_forkchoiceUpdated` call.
279func (s *Service) getPayloadAttribute(ctx context.Context, st state.BeaconState, slot primitives.Slot, headRoot []byte) payloadattribute.Attributer {280	emptyAttri := payloadattribute.EmptyWithVersion(st.Version())
281
282	// If it is an epoch boundary then process slots to get the right
func notifyForkchoiceUpdate has a cyclomatic complexity of 28 with "very-high" risk
 35// notifyForkchoiceUpdate signals execution engine the fork choice updates. Execution engine should:
 36// 1. Re-organizes the execution payload chain and corresponding state to make head_block_hash the head.
 37// 2. Applies finality to the execution state: it irreversibly persists the chain of all execution payloads and corresponding state, up to and including finalized_block_hash.
 38func (s *Service) notifyForkchoiceUpdate(ctx context.Context, arg *fcuConfig) (*enginev1.PayloadIDBytes, error) { 39	ctx, span := trace.StartSpan(ctx, "blockChain.notifyForkchoiceUpdate")
 40	defer span.End()
 41