fix optional handling and mergeContext mock in unit test for EngineEx…changeTransitionConfiguration (#4205)

Signed-off-by: garyschulte <garyschulte@gmail.com>
pull/4210/head
garyschulte 2 years ago committed by GitHub
parent 826648b2de
commit 7c29709fe3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineExchangeTransitionConfiguration.java
  2. 2
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineExchangeTransitionConfigurationTest.java

@ -17,6 +17,7 @@ package org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.engine;
import static org.hyperledger.besu.ethereum.api.jsonrpc.RpcMethod.ENGINE_EXCHANGE_TRANSITION_CONFIGURATION;
import static org.hyperledger.besu.util.Slf4jLambdaHelper.traceLambda;
import org.hyperledger.besu.consensus.merge.MergeContext;
import org.hyperledger.besu.datatypes.Hash;
import org.hyperledger.besu.ethereum.ProtocolContext;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.JsonRpcRequestContext;
@ -82,7 +83,7 @@ public class EngineExchangeTransitionConfiguration extends ExecutionEngineJsonRp
() -> Json.encodePrettily(remoteTransitionConfiguration));
final Optional<BlockHeader> maybeTerminalPoWBlockHeader =
mergeContextOptional.get().getTerminalPoWBlock();
mergeContextOptional.flatMap(MergeContext::getTerminalPoWBlock);
final EngineExchangeTransitionConfigurationResult localTransitionConfiguration =
new EngineExchangeTransitionConfigurationResult(

@ -118,7 +118,7 @@ public class EngineExchangeTransitionConfigurationTest {
@Test
public void shouldReturnDefaultOnNoTerminalTotalDifficultyConfigured() {
when(mergeContext.getTerminalPoWBlock()).thenReturn(Optional.empty());
when(protocolContext.safeConsensusContext(Mockito.any())).thenReturn(Optional.empty());
var response =
resp(

Loading…
Cancel
Save