From e56550f637a40e1ecd4927094c59d325eddb92c5 Mon Sep 17 00:00:00 2001 From: Somnath Date: Wed, 4 Dec 2024 17:31:55 +0400 Subject: [PATCH] Fix bug on pre-Pectra `newPayload` (#12998) Fixes bug introduced in https://github.com/erigontech/erigon/pull/12979 --- turbo/engineapi/engine_server.go | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/turbo/engineapi/engine_server.go b/turbo/engineapi/engine_server.go index 6e77493965d..0a59736149a 100644 --- a/turbo/engineapi/engine_server.go +++ b/turbo/engineapi/engine_server.go @@ -139,14 +139,17 @@ func (s *EngineServer) checkWithdrawalsPresence(time uint64, withdrawals types.W } func (s *EngineServer) checkRequestsPresence(version clparams.StateVersion, executionRequests []hexutility.Bytes) error { - if version < clparams.ElectraVersion && executionRequests != nil { - return &rpc.InvalidParamsError{Message: "requests in EngineAPI not supported before Prague"} - } - if executionRequests == nil { - return &rpc.InvalidParamsError{Message: "missing requests list"} - } - if len(executionRequests) != len(types.KnownRequestTypes) { - return &rpc.InvalidParamsError{Message: "invalid requests lists"} + if version < clparams.ElectraVersion { + if executionRequests != nil { + return &rpc.InvalidParamsError{Message: "requests in EngineAPI not supported before Prague"} + } + } else { + if executionRequests == nil { + return &rpc.InvalidParamsError{Message: "missing requests list"} + } + if len(executionRequests) != len(types.KnownRequestTypes) { + return &rpc.InvalidParamsError{Message: "invalid requests lists"} + } } return nil }