use of org.hyperledger.besu.ethereum.api.query.PrivacyQueries in project besu by hyperledger.
the class RunnerBuilder method createLogsSubscriptionService.
private void createLogsSubscriptionService(final Blockchain blockchain, final WorldStateArchive worldStateArchive, final SubscriptionManager subscriptionManager, final PrivacyParameters privacyParameters) {
Optional<PrivacyQueries> privacyQueries = Optional.empty();
if (privacyParameters.isEnabled()) {
final BlockchainQueries blockchainQueries = new BlockchainQueries(blockchain, worldStateArchive, Optional.empty(), Optional.empty(), apiConfiguration);
privacyQueries = Optional.of(new PrivacyQueries(blockchainQueries, privacyParameters.getPrivateWorldStateReader()));
}
final LogsSubscriptionService logsSubscriptionService = new LogsSubscriptionService(subscriptionManager, privacyQueries);
// monitoring public logs
blockchain.observeLogs(logsSubscriptionService);
// monitoring private logs
if (privacyParameters.isEnabled()) {
blockchain.observeBlockAdded(logsSubscriptionService::checkPrivateLogs);
}
}
Aggregations