Skip to content

Commit

Permalink
Don't initialise GraffitiManager if api not enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
courtneyeh committed Apr 19, 2024
1 parent 4f55037 commit 4656de9
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,17 @@ public static ValidatorClientService create(
final ForkProvider forkProvider = new ForkProvider(config.getSpec(), genesisDataProvider);

final ValidatorRestApiConfig validatorApiConfig = config.getValidatorRestApiConfig();
final GraffitiManager graffitiManager = new GraffitiManager(services.getDataDirLayout());
final Optional<GraffitiManager> graffitiManager =
Optional.ofNullable(
validatorApiConfig.isRestApiEnabled()
? new GraffitiManager(services.getDataDirLayout())
: null);
final ValidatorLoader validatorLoader =
createValidatorLoader(
services,
config,
asyncRunner,
validatorApiConfig.isRestApiEnabled()
? graffitiManager::getGraffiti
: (publicKey) -> Optional.empty());
(publicKey) -> graffitiManager.flatMap(manager -> manager.getGraffiti(publicKey)));
final ValidatorStatusProvider validatorStatusProvider =
new OwnedValidatorStatusProvider(
services.getMetricsSystem(),
Expand Down

0 comments on commit 4656de9

Please sign in to comment.