Moving admin_peers to Admin API group (#473)

Lucas Saldanha 6 years ago committed by GitHub
parent 2722aca1af
commit 8c37c46d63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/JsonRpcMethodsFactory.java
  2. 3
      ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/RpcApis.java
  3. 2
      ethereum/jsonrpc/src/test/java/tech/pegasys/pantheon/ethereum/jsonrpc/JsonRpcHttpServiceTest.java

@ -202,8 +202,7 @@ public class JsonRpcMethodsFactory {
enabledMethods, enabledMethods,
new NetVersion(protocolSchedule.getChainId()), new NetVersion(protocolSchedule.getChainId()),
new NetListening(p2pNetwork), new NetListening(p2pNetwork),
new NetPeerCount(p2pNetwork), new NetPeerCount(p2pNetwork));
new AdminPeers(p2pNetwork));
} }
if (rpcApis.contains(RpcApis.WEB3)) { if (rpcApis.contains(RpcApis.WEB3)) {
addMethods(enabledMethods, new Web3ClientVersion(clientVersion), new Web3Sha3()); addMethods(enabledMethods, new Web3ClientVersion(clientVersion), new Web3Sha3());
@ -217,6 +216,9 @@ public class JsonRpcMethodsFactory {
minerSetCoinbase, minerSetCoinbase,
new MinerSetEtherbase(minerSetCoinbase)); new MinerSetEtherbase(minerSetCoinbase));
} }
if (rpcApis.contains(RpcApis.ADMIN)) {
addMethods(enabledMethods, new AdminPeers(p2pNetwork));
}
// @formatter:off // @formatter:off
return enabledMethods; return enabledMethods;
} }

@ -22,6 +22,7 @@ public class RpcApis {
public static final RpcApi MINER = new RpcApi("MINER"); public static final RpcApi MINER = new RpcApi("MINER");
public static final RpcApi NET = new RpcApi("NET"); public static final RpcApi NET = new RpcApi("NET");
public static final RpcApi WEB3 = new RpcApi("WEB3"); public static final RpcApi WEB3 = new RpcApi("WEB3");
public static final RpcApi ADMIN = new RpcApi("ADMIN");
public static final Collection<RpcApi> DEFAULT_JSON_RPC_APIS = Arrays.asList(ETH, NET, WEB3); public static final Collection<RpcApi> DEFAULT_JSON_RPC_APIS = Arrays.asList(ETH, NET, WEB3);
@ -36,6 +37,8 @@ public class RpcApis {
return Optional.of(NET); return Optional.of(NET);
} else if (name.equals(WEB3.getCliValue())) { } else if (name.equals(WEB3.getCliValue())) {
return Optional.of(WEB3); return Optional.of(WEB3);
} else if (name.equals(ADMIN.getCliValue())) {
return Optional.of(ADMIN);
} else { } else {
return Optional.empty(); return Optional.empty();
} }

@ -94,7 +94,7 @@ public class JsonRpcHttpServiceTest {
protected static BlockchainQueries blockchainQueries; protected static BlockchainQueries blockchainQueries;
protected static Synchronizer synchronizer; protected static Synchronizer synchronizer;
protected static final Collection<RpcApi> JSON_RPC_APIS = protected static final Collection<RpcApi> 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(); protected final JsonRpcTestHelper testHelper = new JsonRpcTestHelper();
@BeforeClass @BeforeClass

Loading…
Cancel
Save