@ -30,7 +30,6 @@ import java.util.Map;
import java.util.Optional ;
import io.vertx.core.Vertx ;
import io.vertx.core.VertxOptions ;
public class ExecutionEngineJsonRpcMethods extends ApiGroupJsonRpcMethods {
@ -38,13 +37,14 @@ public class ExecutionEngineJsonRpcMethods extends ApiGroupJsonRpcMethods {
private final Optional < MergeMiningCoordinator > mergeCoordinator ;
private final ProtocolContext protocolContext ;
private final EthPeers ethPeers ;
private final Vertx consensusEngineServer ;
ExecutionEngineJsonRpcMethods (
final MiningCoordinator miningCoordinator ,
final ProtocolContext protocolContext ,
final EthPeers ethPeers ) {
final EthPeers ethPeers ,
final Vertx consensusEngineServer ) {
this . mergeCoordinator =
Optional . ofNullable ( miningCoordinator )
. filter ( mc - > mc . isCompatibleWithEngineApi ( ) )
@ -52,6 +52,7 @@ public class ExecutionEngineJsonRpcMethods extends ApiGroupJsonRpcMethods {
this . protocolContext = protocolContext ;
this . ethPeers = ethPeers ;
this . consensusEngineServer = consensusEngineServer ;
}
@Override
@ -61,15 +62,17 @@ public class ExecutionEngineJsonRpcMethods extends ApiGroupJsonRpcMethods {
@Override
protected Map < String , JsonRpcMethod > create ( ) {
Vertx syncVertx = Vertx . vertx ( new VertxOptions ( ) . setWorkerPoolSize ( 1 ) ) ;
if ( mergeCoordinator . isPresent ( ) ) {
return mapOf (
new EngineGetPayload ( syncVertx , protocolContext , blockResultFactory ) ,
new EngineNewPayload ( syncVertx , protocolContext , mergeCoordinator . get ( ) , ethPeers ) ,
new EngineForkchoiceUpdated ( syncVertx , protocolContext , mergeCoordinator . get ( ) ) ,
new EngineExchangeTransitionConfiguration ( syncVertx , protocolContext ) ) ;
new EngineGetPayload ( consensusEngineServer , protocolContext , blockResultFactory ) ,
new EngineNewPayload (
consensusEngineServer , protocolContext , mergeCoordinator . get ( ) , ethPeers ) ,
new EngineForkchoiceUpdated (
consensusEngineServer , protocolContext , mergeCoordinator . get ( ) ) ,
new EngineExchangeTransitionConfiguration ( consensusEngineServer , protocolContext ) ) ;
} else {
return mapOf ( new EngineExchangeTransitionConfiguration ( syncVertx , protocolContext ) ) ;
return mapOf (
new EngineExchangeTransitionConfiguration ( consensusEngineServer , protocolContext ) ) ;
}
}
}