diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/JsonRpcMethodsFactory.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/JsonRpcMethodsFactory.java index 4ea8939dce..6b86d7ce8e 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/JsonRpcMethodsFactory.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/JsonRpcMethodsFactory.java @@ -202,8 +202,7 @@ public class JsonRpcMethodsFactory { enabledMethods, new NetVersion(protocolSchedule.getChainId()), new NetListening(p2pNetwork), - new NetPeerCount(p2pNetwork), - new AdminPeers(p2pNetwork)); + new NetPeerCount(p2pNetwork)); } if (rpcApis.contains(RpcApis.WEB3)) { addMethods(enabledMethods, new Web3ClientVersion(clientVersion), new Web3Sha3()); @@ -217,6 +216,9 @@ public class JsonRpcMethodsFactory { minerSetCoinbase, new MinerSetEtherbase(minerSetCoinbase)); } + if (rpcApis.contains(RpcApis.ADMIN)) { + addMethods(enabledMethods, new AdminPeers(p2pNetwork)); + } // @formatter:off return enabledMethods; } diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/RpcApis.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/RpcApis.java index 38c7bee0e4..a29c05652f 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/RpcApis.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/RpcApis.java @@ -22,6 +22,7 @@ public class RpcApis { public static final RpcApi MINER = new RpcApi("MINER"); public static final RpcApi NET = new RpcApi("NET"); public static final RpcApi WEB3 = new RpcApi("WEB3"); + public static final RpcApi ADMIN = new RpcApi("ADMIN"); public static final Collection DEFAULT_JSON_RPC_APIS = Arrays.asList(ETH, NET, WEB3); @@ -36,6 +37,8 @@ public class RpcApis { return Optional.of(NET); } else if (name.equals(WEB3.getCliValue())) { return Optional.of(WEB3); + } else if (name.equals(ADMIN.getCliValue())) { + return Optional.of(ADMIN); } else { return Optional.empty(); } diff --git a/ethereum/jsonrpc/src/test/java/tech/pegasys/pantheon/ethereum/jsonrpc/JsonRpcHttpServiceTest.java b/ethereum/jsonrpc/src/test/java/tech/pegasys/pantheon/ethereum/jsonrpc/JsonRpcHttpServiceTest.java index 77c4afb342..a4945ca6d3 100644 --- a/ethereum/jsonrpc/src/test/java/tech/pegasys/pantheon/ethereum/jsonrpc/JsonRpcHttpServiceTest.java +++ b/ethereum/jsonrpc/src/test/java/tech/pegasys/pantheon/ethereum/jsonrpc/JsonRpcHttpServiceTest.java @@ -94,7 +94,7 @@ public class JsonRpcHttpServiceTest { protected static BlockchainQueries blockchainQueries; protected static Synchronizer synchronizer; protected static final Collection JSON_RPC_APIS = - Arrays.asList(RpcApis.ETH, RpcApis.NET, RpcApis.WEB3); + Arrays.asList(RpcApis.ETH, RpcApis.NET, RpcApis.WEB3, RpcApis.ADMIN); protected final JsonRpcTestHelper testHelper = new JsonRpcTestHelper(); @BeforeClass