Skip to content

Commit

Permalink
Add capabilities caching
Browse files Browse the repository at this point in the history
  • Loading branch information
rubo committed Jan 25, 2023
1 parent ef0abd2 commit aec4e8b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Nethermind/Nethermind.Merge.Plugin/EngineRpcModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace Nethermind.Merge.Plugin;

public partial class EngineRpcModule : IEngineRpcModule
{
private static IEnumerable<string>? _capabilities;
private readonly IHandler<ExecutionStatusResult> _executionStatusHandler;
private readonly IAsyncHandler<Keccak[], ExecutionPayloadBodyV1Result?[]> _executionGetPayloadBodiesByHashV1Handler;
private readonly IGetPayloadBodiesByRangeV1Handler _executionGetPayloadBodiesByRangeV1Handler;
Expand Down Expand Up @@ -50,12 +51,12 @@ public EngineRpcModule(

public ResultWrapper<IEnumerable<string>> engine_getCapabilities()
{
var methods = typeof(IEngineRpcModule).GetMethods()
_capabilities ??= typeof(IEngineRpcModule).GetMethods()
.Select(m => m.Name)
.Where(m => !m.Equals(nameof(engine_getCapabilities), StringComparison.Ordinal))
.Order();

return ResultWrapper<IEnumerable<string>>.Success(methods);
return ResultWrapper<IEnumerable<string>>.Success(_capabilities);
}

public async Task<ResultWrapper<ExecutionPayloadBodyV1Result?[]>> engine_getPayloadBodiesByHashV1(Keccak[] blockHashes)
Expand Down

0 comments on commit aec4e8b

Please sign in to comment.