From f541710c65f68840deef5308b7aec177dfdc386d Mon Sep 17 00:00:00 2001 From: Preeti <35308865+pr9t@users.noreply.github.com> Date: Mon, 30 Sep 2024 04:45:39 +0530 Subject: [PATCH] Chore:Resolved EnginerGetClientVersionV1 fails for local build (#7687) Signed-off-by: Preeti <35308865+pr9t@users.noreply.github.com> Co-authored-by: Sally MacFarlane --- .../internal/methods/engine/EngineGetClientVersionV1.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineGetClientVersionV1.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineGetClientVersionV1.java index 689cb44e6a..149728186b 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineGetClientVersionV1.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineGetClientVersionV1.java @@ -49,9 +49,11 @@ public class EngineGetClientVersionV1 extends ExecutionEngineJsonRpcMethod { @Override public JsonRpcResponse syncResponse(final JsonRpcRequestContext request) { + String safeCommit = + (commit != null && commit.length() >= 8) ? commit.substring(0, 8) : "unknown"; return new JsonRpcSuccessResponse( request.getRequest().getId(), new EngineGetClientVersionResultV1( - ENGINE_CLIENT_CODE, ENGINE_CLIENT_NAME, clientVersion, commit.substring(0, 8))); + ENGINE_CLIENT_CODE, ENGINE_CLIENT_NAME, clientVersion, safeCommit)); } }