use of org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.EngineExchangeTransitionConfigurationResult in project besu by hyperledger.
the class EngineExchangeTransitionConfiguration method syncResponse.
@Override
public JsonRpcResponse syncResponse(final JsonRpcRequestContext requestContext) {
// update our QoS "last call time"
getQosTimer().resetTimer();
final EngineExchangeTransitionConfigurationParameter remoteTransitionConfiguration = requestContext.getRequiredParameter(0, EngineExchangeTransitionConfigurationParameter.class);
final Object reqId = requestContext.getRequest().getId();
traceLambda(LOG, "received transitionConfiguration: {}", () -> Json.encodePrettily(remoteTransitionConfiguration));
final Optional<BlockHeader> maybeTerminalPoWBlockHeader = mergeContext.getTerminalPoWBlock();
final EngineExchangeTransitionConfigurationResult localTransitionConfiguration = new EngineExchangeTransitionConfigurationResult(mergeContext.getTerminalTotalDifficulty(), maybeTerminalPoWBlockHeader.map(BlockHeader::getHash).orElse(Hash.ZERO), maybeTerminalPoWBlockHeader.map(BlockHeader::getNumber).orElse(0L));
if (!localTransitionConfiguration.getTerminalTotalDifficulty().equals(remoteTransitionConfiguration.getTerminalTotalDifficulty())) {
LOG.warn("Configured terminal total difficulty {} does not match value of consensus client {}", localTransitionConfiguration.getTerminalTotalDifficulty(), remoteTransitionConfiguration.getTerminalTotalDifficulty());
}
if (!localTransitionConfiguration.getTerminalBlockHash().equals(remoteTransitionConfiguration.getTerminalBlockHash())) {
LOG.warn("Configured terminal block hash {} does not match value of consensus client {}", localTransitionConfiguration.getTerminalBlockHash(), remoteTransitionConfiguration.getTerminalBlockHash());
}
if (localTransitionConfiguration.getTerminalBlockNumber() != remoteTransitionConfiguration.getTerminalBlockNumber()) {
LOG.debug("Configured terminal block number {} does not match value of consensus client {}", localTransitionConfiguration.getTerminalBlockNumber(), remoteTransitionConfiguration.getTerminalBlockNumber());
}
return respondWith(reqId, localTransitionConfiguration);
}
Aggregations