Search in sources :

Example 1 with EpochCalculator

use of org.hyperledger.besu.ethereum.mainnet.EpochCalculator in project besu by hyperledger.

the class PoWMinerExecutor method createMiner.

@Override
public PoWBlockMiner createMiner(final Subscribers<MinedBlockObserver> observers, final Subscribers<PoWObserver> ethHashObservers, final BlockHeader parentHeader) {
    final PoWSolver solver = new PoWSolver(nonceGenerator, protocolSchedule.getByBlockNumber(parentHeader.getNumber() + 1).getPoWHasher().get(), stratumMiningEnabled, ethHashObservers, epochCalculator, powJobTimeToLive, maxOmmerDepth);
    final Function<BlockHeader, PoWBlockCreator> blockCreator = (header) -> new PoWBlockCreator(coinbase.orElseGet(() -> MergeConfigOptions.isMergeEnabled() ? Address.ZERO : null), () -> targetGasLimit.map(AtomicLong::longValue), parent -> extraData, pendingTransactions, protocolContext, protocolSchedule, solver, minTransactionGasPrice, minBlockOccupancyRatio, parentHeader);
    return new PoWBlockMiner(blockCreator, protocolSchedule, protocolContext, observers, blockScheduler, parentHeader);
}
Also used : MinedBlockObserver(org.hyperledger.besu.ethereum.chain.MinedBlockObserver) PoWSolver(org.hyperledger.besu.ethereum.mainnet.PoWSolver) AbstractPendingTransactionsSorter(org.hyperledger.besu.ethereum.eth.transactions.sorter.AbstractPendingTransactionsSorter) BlockHeader(org.hyperledger.besu.ethereum.core.BlockHeader) PoWObserver(org.hyperledger.besu.ethereum.chain.PoWObserver) Address(org.hyperledger.besu.datatypes.Address) MiningParameters(org.hyperledger.besu.ethereum.core.MiningParameters) Subscribers(org.hyperledger.besu.util.Subscribers) Function(java.util.function.Function) ProtocolSchedule(org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule) AtomicLong(java.util.concurrent.atomic.AtomicLong) ProtocolContext(org.hyperledger.besu.ethereum.ProtocolContext) Optional(java.util.Optional) MergeConfigOptions(org.hyperledger.besu.config.MergeConfigOptions) EpochCalculator(org.hyperledger.besu.ethereum.mainnet.EpochCalculator) BlockHeader(org.hyperledger.besu.ethereum.core.BlockHeader) PoWSolver(org.hyperledger.besu.ethereum.mainnet.PoWSolver)

Aggregations

Optional (java.util.Optional)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1 Function (java.util.function.Function)1 MergeConfigOptions (org.hyperledger.besu.config.MergeConfigOptions)1 Address (org.hyperledger.besu.datatypes.Address)1 ProtocolContext (org.hyperledger.besu.ethereum.ProtocolContext)1 MinedBlockObserver (org.hyperledger.besu.ethereum.chain.MinedBlockObserver)1 PoWObserver (org.hyperledger.besu.ethereum.chain.PoWObserver)1 BlockHeader (org.hyperledger.besu.ethereum.core.BlockHeader)1 MiningParameters (org.hyperledger.besu.ethereum.core.MiningParameters)1 AbstractPendingTransactionsSorter (org.hyperledger.besu.ethereum.eth.transactions.sorter.AbstractPendingTransactionsSorter)1 EpochCalculator (org.hyperledger.besu.ethereum.mainnet.EpochCalculator)1 PoWSolver (org.hyperledger.besu.ethereum.mainnet.PoWSolver)1 ProtocolSchedule (org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule)1 Subscribers (org.hyperledger.besu.util.Subscribers)1