Search in sources :

Example 1 with UDPServer

use of co.rsk.net.discovery.UDPServer in project rskj by rsksmart.

the class RskContext method buildInternalServices.

public synchronized List<InternalService> buildInternalServices() {
    checkIfNotClosed();
    List<InternalService> internalServices = new ArrayList<>();
    internalServices.add(getTransactionPool());
    internalServices.add(getChannelManager());
    internalServices.add(getNodeMessageHandler());
    internalServices.add(getPeerServer());
    boolean rpcHttpEnabled = getRskSystemProperties().isRpcHttpEnabled();
    boolean rpcWebSocketEnabled = getRskSystemProperties().isRpcWebSocketEnabled();
    boolean bloomServiceEnabled = getRskSystemProperties().bloomServiceEnabled();
    if (bloomServiceEnabled) {
        internalServices.add(new BlocksBloomService(getCompositeEthereumListener(), getBlocksBloomStore(), getBlockStore()));
    }
    if (rpcHttpEnabled || rpcWebSocketEnabled) {
        internalServices.add(getWeb3());
    }
    if (rpcHttpEnabled) {
        internalServices.add(getWeb3HttpServer());
    }
    if (rpcWebSocketEnabled) {
        internalServices.add(getWeb3WebSocketServer());
    }
    if (getRskSystemProperties().isPeerDiscoveryEnabled()) {
        internalServices.add(new UDPServer(getRskSystemProperties().getBindAddress().getHostAddress(), getRskSystemProperties().getPeerPort(), getPeerExplorer()));
    }
    if (getRskSystemProperties().isSyncEnabled()) {
        internalServices.add(getSyncPool());
    }
    if (getRskSystemProperties().isMinerServerEnabled()) {
        internalServices.add(getMinerServer());
        if (getRskSystemProperties().isMinerClientEnabled()) {
            internalServices.add(getMinerClient());
        }
    }
    NodeBlockProcessor nodeBlockProcessor = getNodeBlockProcessor();
    if (nodeBlockProcessor instanceof InternalService) {
        internalServices.add((InternalService) nodeBlockProcessor);
    }
    GarbageCollectorConfig gcConfig = getRskSystemProperties().garbageCollectorConfig();
    if (gcConfig.enabled()) {
        internalServices.add(new GarbageCollector(getCompositeEthereumListener(), gcConfig.blocksPerEpoch(), gcConfig.numberOfEpochs(), (MultiTrieStore) getTrieStore(), getBlockStore(), getRepositoryLocator()));
    }
    if (getRskSystemProperties().isPeerScoringStatsReportEnabled()) {
        internalServices.add(getPeerScoringReporterService());
    }
    internalServices.add(new BlockChainFlusher(getRskSystemProperties().flushNumberOfBlocks(), getCompositeEthereumListener(), getTrieStore(), getBlockStore(), getReceiptStore(), getBlocksBloomStore(), getStateRootsStore()));
    return Collections.unmodifiableList(internalServices);
}
Also used : UDPServer(co.rsk.net.discovery.UDPServer) MultiTrieStore(co.rsk.trie.MultiTrieStore) BlocksBloomService(co.rsk.logfilter.BlocksBloomService)

Aggregations

BlocksBloomService (co.rsk.logfilter.BlocksBloomService)1 UDPServer (co.rsk.net.discovery.UDPServer)1 MultiTrieStore (co.rsk.trie.MultiTrieStore)1