protected override void BuildProducer()
        {
            if (_api.EngineSigner == null)
            {
                throw new StepDependencyException(nameof(_api.EngineSigner));
            }
            if (_api.ChainSpec == null)
            {
                throw new StepDependencyException(nameof(_api.ChainSpec));
            }

            ILogger logger = _api.LogManager.GetClassLogger();

            if (logger.IsWarn)
            {
                logger.Warn("Starting AuRa block producer & sealer");
            }

            IAuRaStepCalculator  stepCalculator  = new AuRaStepCalculator(_api.ChainSpec.AuRa.StepDuration, _api.Timestamper, _api.LogManager);
            BlockProducerContext producerContext = GetProducerChain();

            _api.BlockProducer = new AuRaBlockProducer(
                producerContext.TxSource,
                producerContext.ChainProcessor,
                producerContext.ReadOnlyStateProvider,
                _api.Sealer,
                _api.BlockTree,
                _api.BlockProcessingQueue,
                _api.Timestamper,
                stepCalculator,
                _api.ReportingValidator,
                _auraConfig,
                CreateGasLimitCalculator(producerContext.ReadOnlyTxProcessorSource),
                _api.LogManager);
        }
示例#2
0
        protected override void BuildProducer()
        {
            if (_context.NodeKey == null)
            {
                throw new StepDependencyException(nameof(_context.NodeKey));
            }
            if (_context.ChainSpec == null)
            {
                throw new StepDependencyException(nameof(_context.ChainSpec));
            }

            ILogger logger = _context.LogManager.GetClassLogger();

            if (logger.IsWarn)
            {
                logger.Warn("Starting AuRa block producer & sealer");
            }

            IAuRaStepCalculator  stepCalculator  = new AuRaStepCalculator(_context.ChainSpec.AuRa.StepDuration, _context.Timestamper);
            BlockProducerContext producerContext = GetProducerChain();
            var auraConfig = _context.Config <IAuraConfig>();

            _context.BlockProducer = new AuRaBlockProducer(
                producerContext.PendingTxSelector,
                producerContext.ChainProcessor,
                producerContext.ReadOnlyStateProvider,
                _context.Sealer,
                _context.BlockTree,
                _context.BlockProcessingQueue,
                _context.Timestamper,
                _context.LogManager,
                stepCalculator,
                auraConfig,
                _context.NodeKey.Address);
        }
示例#3
0
        protected override void BuildProducer()
        {
            if (_context.ChainSpec == null)
            {
                throw new StepDependencyException(nameof(_context.ChainSpec));
            }
            if (_context.SnapshotManager == null)
            {
                throw new StepDependencyException(nameof(_context.SnapshotManager));
            }
            if (_context.NodeKey == null)
            {
                throw new StepDependencyException(nameof(_context.NodeKey));
            }
            if (_context.BlockTree == null)
            {
                throw new StepDependencyException(nameof(_context.BlockTree));
            }
            if (_context.Sealer == null)
            {
                throw new StepDependencyException(nameof(_context.Sealer));
            }

            ILogger logger = _context.LogManager.GetClassLogger();

            if (logger.IsWarn)
            {
                logger.Warn("Starting Clique block producer & sealer");
            }
            BlockProducerContext producerChain = GetProducerChain();
            CliqueConfig         cliqueConfig  = new CliqueConfig {
                BlockPeriod = _context.ChainSpec.Clique.Period, Epoch = _context.ChainSpec.Clique.Epoch
            };

            _context.BlockProducer = new CliqueBlockProducer(
                producerChain.TxSource,
                producerChain.ChainProcessor,
                producerChain.ReadOnlyStateProvider,
                _context.BlockTree,
                _context.Timestamper,
                _context.CryptoRandom,
                _context.SnapshotManager,
                _context.Sealer,
                _context.NodeKey.Address,
                cliqueConfig,
                _context.LogManager);
        }
        protected override void BuildProducer()
        {
            if (_api.ChainSpec == null)
            {
                throw new StepDependencyException(nameof(_api.ChainSpec));
            }
            if (_api.SnapshotManager == null)
            {
                throw new StepDependencyException(nameof(_api.SnapshotManager));
            }
            if (_api.Signer == null)
            {
                throw new StepDependencyException(nameof(_api.Signer));
            }
            if (_api.BlockTree == null)
            {
                throw new StepDependencyException(nameof(_api.BlockTree));
            }
            if (_api.Sealer == null)
            {
                throw new StepDependencyException(nameof(_api.Sealer));
            }

            ILogger logger = _api.LogManager.GetClassLogger();

            if (logger.IsWarn)
            {
                logger.Warn("Starting Clique block producer & sealer");
            }
            BlockProducerContext producerChain = GetProducerChain();
            CliqueConfig         cliqueConfig  = new CliqueConfig {
                BlockPeriod = _api.ChainSpec.Clique.Period, Epoch = _api.ChainSpec.Clique.Epoch
            };

            _api.BlockProducer = new CliqueBlockProducer(
                producerChain.TxSource,
                producerChain.ChainProcessor,
                producerChain.ReadOnlyStateProvider,
                _api.BlockTree,
                _api.Timestamper,
                _api.CryptoRandom,
                _api.SnapshotManager,
                _api.Sealer,
                new TargetAdjustedGasLimitCalculator(GoerliSpecProvider.Instance, new MiningConfig()),
                cliqueConfig,
                _api.LogManager);
        }
示例#5
0
        protected override void BuildProducer()
        {
            ILogger logger = _context.LogManager.GetClassLogger();

            if (logger.IsWarn)
            {
                logger.Warn("Starting Neth Dev block producer & sealer");
            }
            BlockProducerContext producerChain = GetProducerChain();

            _context.BlockProducer = new DevBlockProducer(
                producerChain.TxSource,
                producerChain.ChainProcessor,
                producerChain.ReadOnlyStateProvider,
                _context.BlockTree,
                _context.BlockProcessingQueue,
                _context.TxPool,
                _context.Timestamper,
                _context.LogManager);
        }
示例#6
0
        public override Eth2BlockProducer Create(
            IBlockTree blockTree,
            IDbProvider dbProvider,
            IReadOnlyTrieStore readOnlyTrieStore,
            IBlockPreprocessorStep blockPreprocessor,
            ITxPool txPool,
            IBlockValidator blockValidator,
            IRewardCalculatorSource rewardCalculatorSource,
            IReceiptStorage receiptStorage,
            IBlockProcessingQueue blockProcessingQueue,
            ISpecProvider specProvider,
            ISigner engineSigner,
            IMiningConfig miningConfig,
            ILogManager logManager)
        {
            BlockProducerContext producerContext = GetProducerChain(
                blockTree,
                dbProvider,
                readOnlyTrieStore,
                blockPreprocessor,
                txPool,
                blockValidator,
                rewardCalculatorSource,
                receiptStorage,
                specProvider,
                miningConfig,
                logManager);

            return(new Eth2TestBlockProducer(
                       producerContext.TxSource,
                       producerContext.ChainProcessor,
                       blockTree,
                       blockProcessingQueue,
                       producerContext.ReadOnlyStateProvider,
                       new TargetAdjustedGasLimitCalculator(specProvider, miningConfig),
                       engineSigner,
                       specProvider,
                       logManager));
        }