From 97cdf617579a8ac4b58ba2968c49d17b18e087c5 Mon Sep 17 00:00:00 2001 From: Daniel Lehrner Date: Fri, 17 Jan 2025 13:27:24 +0100 Subject: [PATCH] check existence of hardfork milestone to decide if engine APIs should be added or not Signed-off-by: Daniel Lehrner --- .../api/jsonrpc/methods/ExecutionEngineJsonRpcMethods.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/ExecutionEngineJsonRpcMethods.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/ExecutionEngineJsonRpcMethods.java index fc0f18d7e5b..c57916f744a 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/ExecutionEngineJsonRpcMethods.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/ExecutionEngineJsonRpcMethods.java @@ -14,6 +14,9 @@ */ package org.hyperledger.besu.ethereum.api.jsonrpc.methods; +import static org.hyperledger.besu.datatypes.HardforkId.MainnetHardforkId.CANCUN; +import static org.hyperledger.besu.datatypes.HardforkId.MainnetHardforkId.PRAGUE; + import org.hyperledger.besu.consensus.merge.blockcreation.MergeMiningCoordinator; import org.hyperledger.besu.ethereum.ProtocolContext; import org.hyperledger.besu.ethereum.api.jsonrpc.RpcApis; @@ -172,7 +175,7 @@ protected Map create() { new EngineGetBlobsV1( consensusEngineServer, protocolContext, engineQosTimer, transactionPool))); - if (protocolSchedule.anyMatch(p -> p.spec().getName().equalsIgnoreCase("cancun"))) { + if (protocolSchedule.milestoneFor(CANCUN).isPresent()) { executionEngineApisSupported.add( new EngineGetPayloadV3( consensusEngineServer, @@ -183,7 +186,7 @@ protected Map create() { protocolSchedule)); } - if (protocolSchedule.anyMatch(p -> p.spec().getName().equalsIgnoreCase("prague"))) { + if (protocolSchedule.milestoneFor(PRAGUE).isPresent()) { executionEngineApisSupported.add( new EngineGetPayloadV4( consensusEngineServer,