diff --git a/beacon_chain/nimbus_beacon_node.nim b/beacon_chain/nimbus_beacon_node.nim index 7b04acc56..fee69fcc3 100644 --- a/beacon_chain/nimbus_beacon_node.nim +++ b/beacon_chain/nimbus_beacon_node.nim @@ -1567,8 +1567,21 @@ proc onSlotEnd(node: BeaconNode, slot: Slot) {.async.} = # If the chain has halted, we have to ensure that the EL gets synced # so that we can perform validator duties again if not node.dag.head.executionValid and not node.dag.chainIsProgressing(): - let beaconHead = node.attestationPool[].getBeaconHead(head) - discard await node.consensusManager.updateExecutionClientHead(beaconHead) + let + beaconHead = node.attestationPool[].getBeaconHead(head) + blck = node.dag.getForkedBlock(beaconHead.blck.bid) + if blck.isSome: + withBlck(blck.get): + when consensusFork >= ConsensusFork.Bellatrix: + if forkyBlck.message.is_execution_block and + not forkyBlck.message.body.execution_payload.block_hash.isZero: + # Both `engine_newPayload` and `engine_forkchoiceUpdated` are + # needed because the EL may have discarded the block since the + # last time that the stale branch was requested to be head + discard await node.elManager + .newExecutionPayload(forkyBlck.message) + discard await node.consensusManager + .updateExecutionClientHead(beaconHead) # If the chain head is far behind, we have to advance it incrementally # to avoid lag spikes when performing validator duties