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