Пример #1
0
 public ConsumerServicesBackgroundProcessor(
     IAccountService accountService,
     IRefundClaimant refundClaimant,
     IDepositConfirmationService depositConfirmationService,
     IGasPriceService gasPriceService,
     IBlockProcessor blockProcessor,
     IDepositDetailsRepository depositRepository,
     IConsumerNotifier consumerNotifier,
     ILogManager logManager,
     IPriceService priceService,
     bool useDepositTimer = false,
     IEthJsonRpcClientProxy?ethJsonRpcClientProxy = null,
     uint depositTimer = 10000)
 {
     _accountService             = accountService;
     _refundClaimant             = refundClaimant;
     _depositConfirmationService = depositConfirmationService;
     _gasPriceService            = gasPriceService;
     _blockProcessor             = blockProcessor;
     _consumerNotifier           = consumerNotifier;
     _priceService          = priceService;
     _depositRepository     = depositRepository;
     _useDepositTimer       = useDepositTimer;
     _ethJsonRpcClientProxy = ethJsonRpcClientProxy;
     _depositTimerPeriod    = depositTimer;
     _logger = logManager.GetClassLogger();
     _gasPriceService.UpdateGasPriceAsync();
     _priceService.UpdateAsync(_currencies);
 }
Пример #2
0
        public virtual async Task<INdmCapabilityConnector> InitAsync(IConfigProvider configProvider,
            IDbProvider dbProvider, string baseDbPath, IBlockTree blockTree,
            ITxPool txPool, ISpecProvider specProvider, IReceiptStorage receiptStorage, IWallet wallet,
            IFilterStore filterStore, IFilterManager filterManager,
            ITimestamper timestamper, IEthereumEcdsa ecdsa, IRpcModuleProvider rpcModuleProvider, IKeyStore keyStore,
            IJsonSerializer jsonSerializer, ICryptoRandom cryptoRandom, IEnode enode,
            INdmConsumerChannelManager consumerChannelManager, INdmDataPublisher dataPublisher, IGrpcServer grpcServer,
            INodeStatsManager nodeStatsManager, IProtocolsManager protocolsManager,
            IProtocolValidator protocolValidator, IMessageSerializationService messageSerializationService,
            bool enableUnsecuredDevWallet, IWebSocketsManager webSocketsManager, ILogManager logManager,
            IBlockProcessor blockProcessor)
        {
            var (config, services, faucet, accountService, consumerService, consumerAddress, providerAddress) =
                await PreInitAsync(configProvider, dbProvider, baseDbPath, blockTree, txPool, specProvider,
                    receiptStorage, wallet, filterStore, filterManager, timestamper, ecdsa, rpcModuleProvider, keyStore,
                    jsonSerializer, cryptoRandom, enode, consumerChannelManager, dataPublisher, grpcServer,
                    enableUnsecuredDevWallet, webSocketsManager, logManager, blockProcessor);
            if (!config.Enabled)
            {
                return default;
            }

            var subprotocolFactory = new NdmSubprotocolFactory(messageSerializationService, nodeStatsManager,
                logManager, accountService, consumerService, consumerChannelManager, ecdsa, wallet, faucet,
                enode.PublicKey, providerAddress, consumerAddress, config.VerifyP2PSignature);
            var protocolHandlerFactory = new ProtocolHandlerFactory(subprotocolFactory, protocolValidator,
                services.RequiredServices.EthRequestService, logManager);
            var capabilityConnector = new NdmCapabilityConnector(protocolsManager, protocolHandlerFactory,
                accountService, logManager);

            return capabilityConnector;
        }
Пример #3
0
        public EthModuleFactory(IDbProvider dbProvider,
                                ITxPool txPool,
                                IWallet wallet,
                                IJsonRpcConfig jsonRpcConfig,
                                IBlockTree blockTree,
                                IEthereumEcdsa ethereumEcdsa,
                                IBlockProcessor blockProcessor,
                                IReceiptFinder receiptFinder,
                                ISpecProvider specProvider,
                                IJsonRpcConfig config,
                                IBloomStorage bloomStorage,
                                ILogManager logManager,
                                bool isMining)
        {
            _dbProvider    = dbProvider ?? throw new ArgumentNullException(nameof(dbProvider));
            _txPool        = txPool ?? throw new ArgumentNullException(nameof(txPool));
            _wallet        = wallet ?? throw new ArgumentNullException(nameof(wallet));
            _jsonRpcConfig = jsonRpcConfig ?? throw new ArgumentNullException(nameof(wallet));
            _blockTree     = blockTree ?? throw new ArgumentNullException(nameof(blockTree));
            _ethereumEcdsa = ethereumEcdsa ?? throw new ArgumentNullException(nameof(ethereumEcdsa));
            _receiptFinder = receiptFinder ?? throw new ArgumentNullException(nameof(receiptFinder));
            _specProvider  = specProvider ?? throw new ArgumentNullException(nameof(specProvider));
            _rpcConfig     = config ?? throw new ArgumentNullException(nameof(config));
            _bloomStorage  = bloomStorage ?? throw new ArgumentNullException(nameof(bloomStorage));
            _logManager    = logManager ?? throw new ArgumentNullException(nameof(logManager));
            _isMining      = isMining;

            _filterStore   = new FilterStore();
            _filterManager = new FilterManager(_filterStore, blockProcessor, _txPool, _logManager);
        }
Пример #4
0
 public bool RegisterBlockTest(IBlockProcessor blockProcessor)
 {
     if (IsBlockStart)
     {
         blockTests.Add(blockProcessor, blockNumber);
     }
     else
     {
         if (Current == null || Current.Trim().Length == 0)
         {
             nextNonWhitespace();
             if (IsBlockStart)
             {
                 blockTests.Add(blockProcessor, blockNumber);
             }
             else
             {
                 errorList.Add("Expecting a block, found " + Current);
             }
         }
         else
         {
             errorList.Add("Expecting a block, found " + Current);
         }
     }
     return(!HasError);
 }
Пример #5
0
 public MtgaService(
     IBlockDispatcher blockDispatcher,
     IBlockProcessor blockProcessor)
 {
     this.blockDispatcher = blockDispatcher;
     this.blockProcessor  = blockProcessor;
 }
Пример #6
0
        public EthModuleFactory(
            IDbProvider dbProvider,
            ITxPool txPool,
            IWallet wallet,
            IBlockTree blockTree,
            IEthereumEcdsa ethereumEcdsa,
            IBlockProcessor blockProcessor,
            IReceiptStorage receiptStorage,
            ISpecProvider specProvider,
            ILogManager logManager)
        {
            _dbProvider     = dbProvider ?? throw new ArgumentNullException(nameof(dbProvider));
            _txPool         = txPool ?? throw new ArgumentNullException(nameof(txPool));
            _wallet         = wallet ?? throw new ArgumentNullException(nameof(wallet));
            _blockTree      = blockTree ?? throw new ArgumentNullException(nameof(blockTree));
            _ethereumEcdsa  = ethereumEcdsa ?? throw new ArgumentNullException(nameof(ethereumEcdsa));
            _blockProcessor = blockProcessor ?? throw new ArgumentNullException(nameof(blockProcessor));
            _receiptStorage = receiptStorage ?? throw new ArgumentNullException(nameof(receiptStorage));
            _specProvider   = specProvider ?? throw new ArgumentNullException(nameof(specProvider));
            _logManager     = logManager ?? throw new ArgumentNullException(nameof(logManager));
            _logger         = logManager.GetClassLogger();

            _filterStore   = new FilterStore();
            _filterManager = new FilterManager(_filterStore, _blockProcessor, _txPool, _logManager);
        }
Пример #7
0
 public void Setup()
 {
     _configProvider            = Substitute.For <IConfigProvider>();
     _configManager             = Substitute.For <IConfigManager>();
     _ndmConfig                 = new NdmConfig();
     _baseDbPath                = "db";
     _rocksProvider             = Substitute.For <IDbProvider>();
     _mongoProvider             = Substitute.For <IMongoProvider>();
     _logManager                = Substitute.For <ILogManager>();
     _blockTree                 = Substitute.For <IBlockTree>();
     _specProvider              = Substitute.For <ISpecProvider>();
     _transactionPool           = Substitute.For <ITxPool>();
     _receiptStorage            = Substitute.For <IReceiptStorage>();
     _filterStore               = Substitute.For <IFilterStore>();
     _filterManager             = Substitute.For <IFilterManager>();
     _wallet                    = Substitute.For <IWallet>();
     _timestamper               = Substitute.For <ITimestamper>();
     _ecdsa                     = Substitute.For <IEthereumEcdsa>();
     _keyStore                  = Substitute.For <IKeyStore>();
     _rpcModuleProvider         = Substitute.For <IRpcModuleProvider>();
     _jsonSerializer            = Substitute.For <IJsonSerializer>();
     _cryptoRandom              = Substitute.For <ICryptoRandom>();
     _enode                     = Substitute.For <IEnode>();
     _ndmConsumerChannelManager = Substitute.For <INdmConsumerChannelManager>();
     _ndmDataPublisher          = Substitute.For <INdmDataPublisher>();
     _grpcServer                = Substitute.For <IGrpcServer>();
     _ethRequestService         = Substitute.For <IEthRequestService>();
     _notifier                  = Substitute.For <INdmNotifier>();
     _enableUnsecuredDevWallet  = false;
     _blockProcessor            = Substitute.For <IBlockProcessor>();
     _ndmModule                 = new NdmModule();
 }
Пример #8
0
        public BaselineModule(
            ITxSender txSender,
            IStateReader stateReader,
            ILogFinder logFinder,
            IBlockFinder blockFinder,
            IAbiEncoder abiEncoder,
            IFileSystem fileSystem,
            IDb baselineDb,
            IDb metadataBaselineDb,
            ILogManager logManager,
            IBlockProcessor blockProcessor,
            DisposableStack disposableStack)
        {
            _abiEncoder         = abiEncoder ?? throw new ArgumentNullException(nameof(abiEncoder));
            _fileSystem         = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem));
            _baselineDb         = baselineDb ?? throw new ArgumentNullException(nameof(baselineDb));
            _metadataBaselineDb = metadataBaselineDb ?? throw new ArgumentNullException(nameof(metadataBaselineDb));
            _logger             = logManager?.GetClassLogger() ?? throw new ArgumentNullException(nameof(logManager));
            _txSender           = txSender ?? throw new ArgumentNullException(nameof(txSender));
            _stateReader        = stateReader ?? throw new ArgumentNullException(nameof(stateReader));
            _logFinder          = logFinder ?? throw new ArgumentNullException(nameof(logFinder));
            _blockFinder        = blockFinder ?? throw new ArgumentNullException(nameof(blockFinder));
            _blockProcessor     = blockProcessor ?? throw new ArgumentNullException(nameof(blockProcessor));
            _baselineTreeHelper = new BaselineTreeHelper(_logFinder, baselineDb, metadataBaselineDb, _logger);
            _disposableStack    = disposableStack ?? throw new ArgumentNullException(nameof(disposableStack));

            _metadata = LoadMetadata();
            InitTrees();
        }
 public DictionaryContractDataStore(
     DictionaryBasedContractDataStoreCollection <T> collection,
     IDataContract <T> dataContract,
     IBlockProcessor blockProcessor,
     ILogManager logManager)
     : this(CreateContractDataStore(collection, dataContract, blockProcessor, logManager))
 {
 }
Пример #10
0
 public void Setup()
 {
     _currentFilterId = 0;
     _filterStore     = Substitute.For <IFilterStore>();
     _blockProcessor  = Substitute.For <IBlockProcessor>();
     _txPool          = Substitute.For <ITxPool>();
     _logManager      = Substitute.For <ILogManager>();
 }
Пример #11
0
 public BlockchainProcessor(
     IBlockchainProcessingStrategy strategy,
     IBlockProcessor blockProcessor
     )
 {
     this._strategy       = strategy;
     this._blockProcessor = blockProcessor;
 }
Пример #12
0
 protected internal ContractDataStore(TCollection collection, IDataContract <T> dataContract, IBlockProcessor blockProcessor, ILogManager logManager)
 {
     Collection      = collection;
     _dataContract   = dataContract ?? throw new ArgumentNullException(nameof(dataContract));
     _blockProcessor = blockProcessor ?? throw new ArgumentNullException(nameof(blockProcessor));;
     _logger         = logManager?.GetClassLogger <ContractDataStore <T, TCollection> >() ?? throw new ArgumentNullException(nameof(logManager));
     _blockProcessor.BlockProcessed += OnBlockProcessed;
 }
Пример #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ShareManager" /> class.
 /// </summary>
 /// <param name="poolConfig"></param>
 /// <param name="daemonClient"></param>
 /// <param name="jobTracker"></param>
 /// <param name="storageLayer"></param>
 /// <param name="blockProcessor"></param>
 public ShareManager(IPoolConfig poolConfig, IDaemonClient daemonClient, IJobTracker jobTracker, IStorageLayer storageLayer, IBlockProcessor blockProcessor)
 {
     _poolConfig     = poolConfig;
     _daemonClient   = daemonClient;
     _jobTracker     = jobTracker;
     _storageLayer   = storageLayer;
     _blockProcessor = blockProcessor;
     _logger         = Log.ForContext <ShareManager>().ForContext("Component", poolConfig.Coin.Name);
 }
Пример #14
0
        private IAuRaValidator CreateAuRaValidator(IBlockProcessor processor, IReadOnlyTxProcessorSource readOnlyTxProcessorSource)
        {
            if (_api.ChainSpec == null)
            {
                throw new StepDependencyException(nameof(_api.ChainSpec));
            }
            if (_api.BlockTree == null)
            {
                throw new StepDependencyException(nameof(_api.BlockTree));
            }
            if (_api.EngineSigner == null)
            {
                throw new StepDependencyException(nameof(_api.EngineSigner));
            }
            if (_api.SpecProvider == null)
            {
                throw new StepDependencyException(nameof(_api.SpecProvider));
            }

            var chainSpecAuRa = _api.ChainSpec.AuRa;

            _api.FinalizationManager = new AuRaBlockFinalizationManager(
                _api.BlockTree,
                _api.ChainLevelInfoRepository,
                processor,
                _api.ValidatorStore,
                new ValidSealerStrategy(),
                _api.LogManager,
                chainSpecAuRa.TwoThirdsMajorityTransition);

            IAuRaValidator validator = new AuRaValidatorFactory(
                _api.StateProvider,
                _api.AbiEncoder,
                _api.TransactionProcessor,
                readOnlyTxProcessorSource,
                _api.BlockTree,
                _api.ReceiptStorage,
                _api.ValidatorStore,
                _api.FinalizationManager,
                new TxPoolSender(_api.TxPool, new NonceReservingTxSealer(_api.EngineSigner, _api.Timestamper, _api.TxPool)),
                _api.TxPool,
                NethermindApi.Config <IMiningConfig>(),
                _api.LogManager,
                _api.EngineSigner,
                _api.SpecProvider,
                _api.ReportingContractValidatorCache,
                chainSpecAuRa.PosdaoTransition,
                false)
                                       .CreateValidatorProcessor(chainSpecAuRa.Validators, _api.BlockTree.Head?.Header);

            if (validator is IDisposable disposableValidator)
            {
                _api.DisposeStack.Push(disposableValidator);
            }

            return(validator);
        }
Пример #15
0
        public PaymentProcessor(IPoolConfig poolConfig, IStorageLayer storageLayer, IDaemonClient daemonClient, IBlockProcessor blockProcessor)
        {
            _poolConfig     = poolConfig;
            _daemonClient   = daemonClient;
            _storageLayer   = storageLayer;
            _blockProcessor = blockProcessor;

            _logger = Log.ForContext <PaymentProcessor>().ForContext("Component", poolConfig.Coin.Name);
        }
        public void Initialize()
        {
            _chainLevelInfoRepository = Substitute.For <IChainLevelInfoRepository>();
            _blockProcessor           = Substitute.For <IBlockProcessor>();
            _validatorStore           = Substitute.For <IValidatorStore>();
            _logManager          = LimboLogs.Instance;
            _validSealerStrategy = Substitute.For <IValidSealerStrategy>();

            _validatorStore.GetValidators(Arg.Any <long?>()).Returns(new Address[] { TestItem.AddressA, TestItem.AddressB, TestItem.AddressC });
        }
Пример #17
0
 public AuRaBlockFinalizationManager(IBlockTree blockTree, IChainLevelInfoRepository chainLevelInfoRepository, IBlockProcessor blockProcessor, IAuRaValidator auRaValidator, ILogManager logManager)
 {
     _blockTree = blockTree ?? throw new ArgumentNullException(nameof(blockTree));
     _chainLevelInfoRepository = chainLevelInfoRepository ?? throw new ArgumentNullException(nameof(chainLevelInfoRepository));
     _auRaValidator            = auRaValidator ?? throw new ArgumentNullException(nameof(auRaValidator));
     _logger         = logManager?.GetClassLogger() ?? throw new ArgumentNullException(nameof(logManager));
     _blockProcessor = blockProcessor ?? throw new ArgumentNullException(nameof(blockProcessor));
     _blockProcessor.BlockProcessed += OnBlockProcessed;
     Initialize();
 }
Пример #18
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="blockProcessor">Block Pool</param>
 /// <param name="blockOperationsManager">The block operations mananger.</param>
 /// <param name="broadcaster">Broadcaster</param>
 /// <param name="logger">Logger</param>
 public BlockMessageHandler(
     IBlockProcessor blockProcessor,
     IBlockOperationsManager blockOperationsManager,
     IBroadcaster broadcaster,
     ILogger<BlockMessageHandler> logger)
 {
     _blockProcessor = blockProcessor ?? throw new ArgumentNullException(nameof(blockProcessor));
     _blockOperationsManager = blockOperationsManager ?? throw new ArgumentNullException(nameof(blockOperationsManager));
     _broadcaster = broadcaster ?? throw new ArgumentNullException(nameof(broadcaster));
     _logger = logger;
 }
 public DictionaryContractDataStore(
     DictionaryBasedContractDataStoreCollection <T> collection,
     IDataContract <T> dataContract,
     IBlockProcessor blockProcessor,
     ILogManager logManager,
     ILocalDataSource <IEnumerable <T> > localDataSource)
     : this(localDataSource == null
         ? CreateContractDataStore(collection, dataContract, blockProcessor, logManager)
         : CreateContractDataStoreWithLocalData(collection, dataContract, blockProcessor, logManager, localDataSource))
 {
 }
Пример #20
0
        public void Initialize()
        {
            _chainLevelInfoRepository = Substitute.For <IChainLevelInfoRepository>();
            _blockProcessor           = Substitute.For <IBlockProcessor>();
            _auraValidator            = Substitute.For <IAuRaValidator>();
            _logManager = Substitute.For <ILogManager>();

            _auraValidator.MinSealersForFinalization.Returns(2);

            Rlp.Decoders[typeof(BlockInfo)] = new BlockInfoDecoder(true);
        }
Пример #21
0
        public PaymentProcessor(IPoolConfig poolConfig, IDaemonClient daemonClient, IStorage storage, IBlockProcessor blockProcessor)
        {
            _daemonClient   = daemonClient;
            _storage        = storage;
            _blockProcessor = blockProcessor;

            _walletConfig  = poolConfig.Wallet;
            _rewardsConfig = poolConfig.Rewards;

            _logger = Log.ForContext <PaymentProcessor>().ForContext("Component", poolConfig.Coin.Name);
        }
 public TransactionsSubscription(IEnumerable <IProducer> producers, IBlockProcessor blockProcessor, ILogManager logManager)
 {
     _producers      = producers ?? throw new ArgumentNullException(nameof(producers));
     _blockProcessor = blockProcessor ?? throw new ArgumentNullException(nameof(blockProcessor));
     _logger         = logManager.GetClassLogger();
     _blockProcessor.TransactionProcessed += OnTransactionProcessed;
     if (_logger.IsInfo)
     {
         _logger.Info("New data subscription started");
     }
 }
Пример #23
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="blockProcessor">Block Processor</param>
 /// <param name="blockchainContext">Block chain context class.</param>
 /// <param name="genesisBuilder">Genesis block generator.</param>
 /// <param name="blockRepository">The block model.</param>
 public Blockchain(
     IBlockProcessor blockProcessor,
     IBlockchainContext blockchainContext,
     IGenesisBuilder genesisBuilder,
     IBlockRepository blockRepository)
 {
     _blockProcessor    = blockProcessor ?? throw new ArgumentNullException(nameof(blockProcessor));
     _blockchainContext = blockchainContext ?? throw new ArgumentNullException(nameof(blockchainContext));
     _genesisBuilder    = genesisBuilder ?? throw new ArgumentNullException(nameof(genesisBuilder));
     _blockRepository   = blockRepository;
 }
        public void Initialize()
        {
            _chainLevelInfoRepository = Substitute.For <IChainLevelInfoRepository>();
            _blockProcessor           = Substitute.For <IBlockProcessor>();
            _validatorStore           = Substitute.For <IValidatorStore>();
            _logManager          = LimboLogs.Instance;
            _validSealerStrategy = Substitute.For <IValidSealerStrategy>();

            _validatorStore.GetValidators().Returns(new Address[] { TestItem.AddressA, TestItem.AddressB, TestItem.AddressC });

            Rlp.Decoders[typeof(BlockInfo)] = new BlockInfoDecoder(true);
        }
Пример #25
0
        public GZipArchivator(Settings settings)
        {
            var factory = ArchivatorFactory.CreateFactory(settings);

            _reader    = factory.GetReader();
            _writer    = factory.GetWriter();
            _processor = factory.GetBlockProcessor();

            _processingBuffer = new BlockingQueue <Block>();
            _writingBuffer    = new BlockingDictionary <int, Block>();
            _blocksLimiter    = new Semaphore(settings.BlocksLimit, settings.BlocksLimit);
        }
 private static ContractDataStoreWithLocalData <T, DictionaryBasedContractDataStoreCollection <T> > CreateContractDataStoreWithLocalData(
     DictionaryBasedContractDataStoreCollection <T> collection,
     IDataContract <T> dataContract,
     IBlockProcessor blockProcessor,
     ILogManager logManager,
     ILocalDataSource <IEnumerable <T> > localDataSource) =>
 new ContractDataStoreWithLocalData <T, DictionaryBasedContractDataStoreCollection <T> >(
     collection,
     dataContract ?? new EmptyDataContract <T>(),
     blockProcessor,
     logManager,
     localDataSource);
Пример #27
0
 protected internal ContractDataStoreWithLocalData(
     TCollection collection,
     IDataContract <T> dataContract,
     IBlockProcessor blockProcessor,
     ILogManager logManager,
     ILocalDataSource <IEnumerable <T> > localDataSource)
     : base(collection, dataContract, blockProcessor, logManager)
 {
     _localDataSource          = localDataSource ?? throw new ArgumentNullException(nameof(localDataSource));
     _localDataSource.Changed += OnChanged;
     LoadLocalData();
 }
Пример #28
0
        public IPaymentManager GetPaymentManager(IPoolConfig poolConfig, IBlockProcessor blockProcessor, IBlockAccounter blockAccounter, IPaymentProcessor paymentProcessor)
        {
            var @params = new NamedParameterOverloads
            {
                { "poolConfig", poolConfig },
                { "blockProcessor", blockProcessor },
                { "blockAccounter", blockAccounter },
                { "paymentProcessor", paymentProcessor }
            };

            return(_applicationContext.Container.Resolve <IPaymentManager>(@params));
        }
Пример #29
0
 public FilterManager(IFilterStore filterStore, IBlockProcessor blockProcessor, ITxPool txPool,
                      ILogManager logManager)
 {
     _filterStore   = filterStore ?? throw new ArgumentNullException(nameof(filterStore));
     blockProcessor = blockProcessor ?? throw new ArgumentNullException(nameof(blockProcessor));
     txPool         = txPool ?? throw new ArgumentNullException(nameof(txPool));
     _logger        = logManager?.GetClassLogger() ?? throw new ArgumentNullException(nameof(logManager));
     blockProcessor.BlockProcessed       += OnBlockProcessed;
     blockProcessor.TransactionProcessed += OnTransactionProcessed;
     _filterStore.FilterRemoved          += OnFilterRemoved;
     txPool.NewPending     += OnNewPendingTransaction;
     txPool.RemovedPending += OnRemovedPendingTransaction;
 }
Пример #30
0
        private IAuRaValidator CreateAuRaValidator(IBlockProcessor processor)
        {
            if (_context.ChainSpec == null)
            {
                throw new StepDependencyException(nameof(_context.ChainSpec));
            }
            if (_context.BlockTree == null)
            {
                throw new StepDependencyException(nameof(_context.BlockTree));
            }
            if (_context.Signer == null)
            {
                throw new StepDependencyException(nameof(_context.Signer));
            }

            var chainSpecAuRa = _context.ChainSpec.AuRa;

            _context.FinalizationManager = new AuRaBlockFinalizationManager(
                _context.BlockTree,
                _context.ChainLevelInfoRepository,
                processor,
                _context.ValidatorStore,
                new ValidSealerStrategy(),
                _context.LogManager,
                chainSpecAuRa.TwoThirdsMajorityTransition);

            IAuRaValidator validator = new AuRaValidatorFactory(
                _context.StateProvider,
                _context.AbiEncoder,
                _context.TransactionProcessor,
                GetReadOnlyTransactionProcessorSource(),
                _context.BlockTree,
                _context.ReceiptStorage,
                _context.ValidatorStore,
                _context.FinalizationManager,
                new TxPoolSender(_context.TxPool, new TxNonceTxPoolReserveSealer(_context.Signer, _context.Timestamper, _context.TxPool)),
                _context.TxPool,
                _context.LogManager,
                _context.Signer,
                _context.ReportingContractValidatorCache,
                chainSpecAuRa.PosdaoTransition,
                false)
                                       .CreateValidatorProcessor(chainSpecAuRa.Validators, _context.BlockTree.Head?.Header);

            if (validator is IDisposable disposableValidator)
            {
                _context.DisposeStack.Push(disposableValidator);
            }

            return(validator);
        }
Пример #31
0
        public PaymentManager(IPoolConfig poolConfig,  IBlockProcessor blockProcessor, IBlockAccounter blockAccounter, IPaymentProcessor paymentProcessor)
        {
            _poolConfig = poolConfig;
            _labors = new List<IPaymentLabor>
            {
                blockProcessor,
                blockAccounter, 
                paymentProcessor
            };

            _logger = Log.ForContext<PaymentManager>().ForContext("Component", poolConfig.Coin.Name);

            if (!_poolConfig.Payments.Enabled) // make sure payments are enabled.
                return;

            // setup the timer to run payment laberos 
            _timer = new Timer(Run, null, _poolConfig.Payments.Interval * 1000, Timeout.Infinite);
        }
Пример #32
0
        public IPaymentManager GetPaymentManager(IPoolConfig poolConfig, IBlockProcessor blockProcessor, IBlockAccounter blockAccounter, IPaymentProcessor paymentProcessor)
        {
            var @params = new NamedParameterOverloads
            {
                {"poolConfig", poolConfig},
                {"blockProcessor", blockProcessor},
                {"blockAccounter", blockAccounter},
                {"paymentProcessor", paymentProcessor}
            };

            return _applicationContext.Container.Resolve<IPaymentManager>(@params);
        }