Search in sources :

Example 1 with RskCustomCache

use of co.rsk.util.RskCustomCache in project rskj by rsksmart.

the class RskContext method getHashRateCalculator.

public synchronized HashRateCalculator getHashRateCalculator() {
    checkIfNotClosed();
    if (hashRateCalculator == null) {
        RskCustomCache<Keccak256, BlockHeaderElement> cache = new RskCustomCache<>(60000L);
        if (!getRskSystemProperties().isMinerServerEnabled()) {
            hashRateCalculator = new HashRateCalculatorNonMining(getBlockStore(), cache);
        } else {
            RskAddress coinbase = getMiningConfig().getCoinbaseAddress();
            hashRateCalculator = new HashRateCalculatorMining(getBlockStore(), cache, coinbase);
        }
    }
    return hashRateCalculator;
}
Also used : HashRateCalculatorNonMining(co.rsk.metrics.HashRateCalculatorNonMining) Keccak256(co.rsk.crypto.Keccak256) BlockHeaderElement(co.rsk.metrics.BlockHeaderElement) RskCustomCache(co.rsk.util.RskCustomCache) HashRateCalculatorMining(co.rsk.metrics.HashRateCalculatorMining)

Aggregations

Keccak256 (co.rsk.crypto.Keccak256)1 BlockHeaderElement (co.rsk.metrics.BlockHeaderElement)1 HashRateCalculatorMining (co.rsk.metrics.HashRateCalculatorMining)1 HashRateCalculatorNonMining (co.rsk.metrics.HashRateCalculatorNonMining)1 RskCustomCache (co.rsk.util.RskCustomCache)1