Skip to content

Commit

Permalink
Prevent rpc endpoints from being overridden
Browse files Browse the repository at this point in the history
Signed-off-by: Antony Denyer <[email protected]>
  • Loading branch information
antonydenyer committed Sep 30, 2021
1 parent 05479e4 commit fc65ddf
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion besu/src/main/java/org/hyperledger/besu/RunnerBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,16 @@ private Map<String, JsonRpcMethod> jsonRpcMethods(
dataDir,
besuController.getProtocolManager().ethContext().getEthPeers());
methods.putAll(besuController.getAdditionalJsonRpcMethods(jsonRpcApis));
methods.putAll(rpcEndpointServiceImpl.getPluginMethods(jsonRpcConfiguration.getRpcApis()));

var pluginMethods = rpcEndpointServiceImpl.getPluginMethods(jsonRpcConfiguration.getRpcApis());

var overriddenMethods =
methods.keySet().stream().filter(pluginMethods::containsKey).collect(Collectors.toList());
if (overriddenMethods.size() > 0) {
throw new RuntimeException("You can not override built in methods " + overriddenMethods);
}

methods.putAll(pluginMethods);
return methods;
}

Expand Down

0 comments on commit fc65ddf

Please sign in to comment.