use of org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.TraceTypeParameter.TraceType.TRACE in project besu by hyperledger.
the class TraceReplayBlockTransactions method resultByBlockNumber.
@Override
protected Object resultByBlockNumber(final JsonRpcRequestContext request, final long blockNumber) {
final TraceTypeParameter traceTypeParameter = request.getRequiredParameter(1, TraceTypeParameter.class);
LOG.trace("Received RPC rpcName={} block={} traceType={}", getName(), blockNumber, traceTypeParameter);
if (blockNumber == BlockHeader.GENESIS_BLOCK_NUMBER) {
// Nothing to trace for the genesis block
return emptyResult();
}
return getBlockchainQueries().getBlockchain().getBlockByNumber(blockNumber).map((block) -> traceBlock(block, traceTypeParameter)).orElse(null);
}
use of org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.TraceTypeParameter.TraceType.TRACE in project besu by hyperledger.
the class TraceReplayBlockTransactions method traceBlock.
private Object traceBlock(final Block block, final TraceTypeParameter traceTypeParameter) {
if (block == null || block.getBody().getTransactions().isEmpty()) {
return emptyResult();
}
final Set<TraceTypeParameter.TraceType> traceTypes = traceTypeParameter.getTraceTypes();
final TraceOptions traceOptions = new TraceOptions(false, false, traceTypes.contains(VM_TRACE) || traceTypes.contains(TRACE));
return blockTracerSupplier.get().trace(block, new DebugOperationTracer(traceOptions)).map(BlockTrace::getTransactionTraces).map((traces) -> generateTracesFromTransactionTrace(traces, block, traceTypes)).orElse(null);
}
Aggregations