Search in sources :

Example 1 with PrivacyQueries

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);
    }
}
Also used : LogsSubscriptionService(org.hyperledger.besu.ethereum.api.jsonrpc.websocket.subscription.logs.LogsSubscriptionService) PrivacyQueries(org.hyperledger.besu.ethereum.api.query.PrivacyQueries) BlockchainQueries(org.hyperledger.besu.ethereum.api.query.BlockchainQueries)

Aggregations

LogsSubscriptionService (org.hyperledger.besu.ethereum.api.jsonrpc.websocket.subscription.logs.LogsSubscriptionService)1 BlockchainQueries (org.hyperledger.besu.ethereum.api.query.BlockchainQueries)1 PrivacyQueries (org.hyperledger.besu.ethereum.api.query.PrivacyQueries)1