protected override void InitSealEngine()
        {
            if (_context.DbProvider == null)
            {
                throw new StepDependencyException(nameof(_context.DbProvider));
            }
            if (_context.ChainSpec == null)
            {
                throw new StepDependencyException(nameof(_context.ChainSpec));
            }
            if (_context.EthereumEcdsa == null)
            {
                throw new StepDependencyException(nameof(_context.EthereumEcdsa));
            }
            if (_context.NodeKey == null)
            {
                throw new StepDependencyException(nameof(_context.NodeKey));
            }

            AbiEncoder abiEncoder = new AbiEncoder();

            _context.ValidatorStore = new ValidatorStore(_context.DbProvider.BlockInfosDb);
            IReadOnlyTransactionProcessorSource readOnlyTransactionProcessorSource = new ReadOnlyTransactionProcessorSource(_context.DbProvider, _context.BlockTree, _context.SpecProvider, _context.LogManager);
            IAuRaValidatorProcessorExtension    validatorProcessorExtension        = new AuRaValidatorProcessorFactory(_context.StateProvider, abiEncoder, _context.TransactionProcessor, readOnlyTransactionProcessorSource, _context.BlockTree, _context.ReceiptStorage, _context.ValidatorStore, _context.LogManager)
                                                                                     .CreateValidatorProcessor(_context.ChainSpec.AuRa.Validators);

            AuRaStepCalculator auRaStepCalculator = new AuRaStepCalculator(_context.ChainSpec.AuRa.StepDuration, _context.Timestamper);

            _context.SealValidator          = new AuRaSealValidator(_context.ChainSpec.AuRa, auRaStepCalculator, _context.ValidatorStore, _context.EthereumEcdsa, _context.LogManager);
            _context.RewardCalculatorSource = AuRaRewardCalculator.GetSource(_context.ChainSpec.AuRa, abiEncoder);
            _context.Sealer = new AuRaSealer(_context.BlockTree, _context.ValidatorStore, auRaStepCalculator, _context.NodeKey.Address, new BasicWallet(_context.NodeKey), new ValidSealerStrategy(), _context.LogManager);
            _context.AuRaBlockProcessorExtension = validatorProcessorExtension;
        }
        protected override void InitSealEngine()
        {
            if (_api.DbProvider == null)
            {
                throw new StepDependencyException(nameof(_api.DbProvider));
            }
            if (_api.ChainSpec == null)
            {
                throw new StepDependencyException(nameof(_api.ChainSpec));
            }
            if (_api.EthereumEcdsa == null)
            {
                throw new StepDependencyException(nameof(_api.EthereumEcdsa));
            }
            if (_api.BlockTree == null)
            {
                throw new StepDependencyException(nameof(_api.BlockTree));
            }

            _api.ValidatorStore = new ValidatorStore(_api.DbProvider.BlockInfosDb);

            ValidSealerStrategy validSealerStrategy = new ValidSealerStrategy();
            AuRaStepCalculator  auRaStepCalculator  = new AuRaStepCalculator(_api.ChainSpec.AuRa.StepDuration, _api.Timestamper, _api.LogManager);

            _api.SealValidator          = _sealValidator = new AuRaSealValidator(_api.ChainSpec.AuRa, auRaStepCalculator, _api.BlockTree, _api.ValidatorStore, validSealerStrategy, _api.EthereumEcdsa, _api.LogManager);
            _api.RewardCalculatorSource = AuRaRewardCalculator.GetSource(_api.ChainSpec.AuRa, _api.AbiEncoder);
            _api.Sealer         = new AuRaSealer(_api.BlockTree, _api.ValidatorStore, auRaStepCalculator, _api.EngineSigner, validSealerStrategy, _api.LogManager);
            _auRaStepCalculator = auRaStepCalculator;
        }
Пример #3
0
        protected override void InitSealEngine()
        {
            if (_context.DbProvider == null)
            {
                throw new StepDependencyException(nameof(_context.DbProvider));
            }
            if (_context.ChainSpec == null)
            {
                throw new StepDependencyException(nameof(_context.ChainSpec));
            }
            if (_context.EthereumEcdsa == null)
            {
                throw new StepDependencyException(nameof(_context.EthereumEcdsa));
            }
            if (_context.NodeKey == null)
            {
                throw new StepDependencyException(nameof(_context.NodeKey));
            }


            _context.ValidatorStore = new ValidatorStore(_context.DbProvider.BlockInfosDb);

            AuRaStepCalculator auRaStepCalculator = new AuRaStepCalculator(_context.ChainSpec.AuRa.StepDuration, _context.Timestamper, _context.LogManager);

            _context.SealValidator          = new AuRaSealValidator(_context.ChainSpec.AuRa, auRaStepCalculator, _context.ValidatorStore, _context.EthereumEcdsa, _context.LogManager);
            _context.RewardCalculatorSource = AuRaRewardCalculator.GetSource(_context.ChainSpec.AuRa, _context.AbiEncoder);
            _context.Sealer = new AuRaSealer(_context.BlockTree, _context.ValidatorStore, auRaStepCalculator, _context.NodeKey.Address, new BasicWallet(_context.NodeKey), new ValidSealerStrategy(), _context.LogManager);
        }