fix `produceBlockV2` call for Capella (#4443)

Avoid issue when calling `/eth/v2/validator/blocks/{slot}` for a
Capella slot via VC, same logic as in `validator_duties`.
This commit is contained in:
Etan Kissling 2022-12-21 11:35:56 +01:00 committed by GitHub
parent adcc57e7ca
commit 12b428e3d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -16,6 +16,7 @@ import ".."/[beacon_chain_db, beacon_node],
"."/[rest_utils, state_ttl_cache]
from ".."/spec/datatypes/bellatrix import ExecutionPayload
from ".."/spec/datatypes/capella import ExecutionPayload
export rest_utils
@ -374,6 +375,10 @@ proc installValidatorApiHandlers*(router: var RestRouter, node: BeaconNode) =
return RestApiResponse.jsonError(Http400, InvalidRandaoRevealValue)
let res =
if qslot.epoch >= node.dag.cfg.CAPELLA_FORK_EPOCH:
await makeBeaconBlockForHeadAndSlot[capella.ExecutionPayload](
node, qrandao, proposer.get(), qgraffiti, qhead, qslot)
else:
await makeBeaconBlockForHeadAndSlot[bellatrix.ExecutionPayload](
node, qrandao, proposer.get(), qgraffiti, qhead, qslot)
if res.isErr():