diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/DebugReplayBlock.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/DebugReplayBlock.java index 9d097cc6b24..2ed8959052b 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/DebugReplayBlock.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/DebugReplayBlock.java @@ -17,7 +17,6 @@ import static org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcError.INTERNAL_ERROR; import static org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcError.UNKNOWN_BLOCK; -import org.hyperledger.besu.ethereum.BlockValidator; import org.hyperledger.besu.ethereum.ProtocolContext; import org.hyperledger.besu.ethereum.api.jsonrpc.RpcMethod; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.AbstractBlockParameterMethod; @@ -73,20 +72,19 @@ protected Object resultByBlockNumber( // rewind to the block before the one we want to replay protocolContext.getBlockchain().rewindToBlock(blockNumber - 1); - // replay block and persist it - final BlockValidator.Result result = - protocolSchedule - .getByBlockNumber(blockNumber) - .getBlockValidator() - .validateAndProcessBlock( - protocolContext, - maybeBlock.get(), - HeaderValidationMode.FULL, - HeaderValidationMode.NONE, - true); - - if (!result.isValid) { - LOG.error(result.errorMessage.orElse("Empty error response")); + try { + // replay block and persist it + protocolSchedule + .getByBlockNumber(blockNumber) + .getBlockValidator() + .validateAndProcessBlock( + protocolContext, + maybeBlock.get(), + HeaderValidationMode.FULL, + HeaderValidationMode.NONE, + true); + } catch (Exception e) { + LOG.error(e.getMessage()); return new JsonRpcErrorResponse(request.getRequest().getId(), INTERNAL_ERROR); }