class DebugStandardTraceBadBlockToFile extends DebugStandardTraceBlockToFile implements JsonRpcMethod {

  @Override
  public JsonRpcResponse response(final JsonRpcRequestContext requestContext) {
    final Hash blockHash = requestContext.getRequiredParameter(0, Hash.class);
    final Optional<TransactionTraceParams> transactionTraceParams =
        requestContext.getOptionalParameter(1, TransactionTraceParams.class);

    final Blockchain blockchain = blockchainQueries.get().getBlockchain();
    final ProtocolSpec protocolSpec =
        protocolSchedule.getByBlockNumber(blockchain.getChainHeadHeader().getNumber());
    final BadBlockManager badBlockManager = protocolSpec.getBadBlocksManager();

    return badBlockManager
        .getBadBlock(blockHash)
        .map(
            block ->
                (JsonRpcResponse)
                    new JsonRpcSuccessResponse(
                        requestContext.getRequest().getId(),
                        traceBlock(block, transactionTraceParams)))
        .orElse(
            new JsonRpcErrorResponse(
                requestContext.getRequest().getId(), JsonRpcError.BLOCK_NOT_FOUND));
  }

  public  DebugStandardTraceBadBlockToFile(
      final Supplier<TransactionTracer> transactionTracerSupplier,
      final BlockchainQueries blockchainQueries,
      final ProtocolSchedule protocolSchedule,
      final Path dataDir);

}