Exemplo n.º 1
0
        public SynchronizationProcessor(ILogger <SynchronizationProcessor> logger,
                                        IEventBus eventBus,
                                        IDateTimeProvider dateTimeProvider,
                                        IPeerBehaviorManager peerBehaviorManager,
                                        IConsensusParameters consensusParameters,
                                        IInitialBlockDownloadTracker ibdState,
                                        IBlockHeaderHashCalculator blockHeaderHashCalculator,
                                        ITransactionHashCalculator transactionHashCalculator,
                                        IBlockFetcherManager blockFetcherManager,
                                        ILocalServiceProvider localServiceProvider,
                                        IChainState chainState,
                                        IHeaderValidator headerValidator,
                                        IBlockValidator blockValidator,
                                        IPeriodicWork headerSyncLoop,
                                        IOptions <BitcoinSettings> options)
            : base(logger, eventBus, peerBehaviorManager, isHandshakeAware: true, receiveMessagesOnlyIfHandshaked: true)
        {
            _dateTimeProvider          = dateTimeProvider;
            _consensusParameters       = consensusParameters;
            _ibdState                  = ibdState;
            _blockHeaderHashCalculator = blockHeaderHashCalculator;
            _transactionHashCalculator = transactionHashCalculator;
            _blockFetcherManager       = blockFetcherManager;
            _localServiceProvider      = localServiceProvider;
            _chainState                = chainState;
            _headerValidator           = headerValidator;
            _blockValidator            = blockValidator;
            _headerSyncLoop            = headerSyncLoop;
            _options = options.Value;


            _minimumChainWork = _options.MinimumChainWork ?? _consensusParameters.MinimumChainWork;
            if (_minimumChainWork < _consensusParameters.MinimumChainWork)
            {
                this.logger.LogWarning($"{nameof(_minimumChainWork)} set below default value of {_consensusParameters.MinimumChainWork}");
            }

            headerSyncLoop.Configure(stopOnException: false, this);
        }
 public BlockFetcherManagerController(ILogger <ConsensusController> logger, IEventBus eventBus, IBlockFetcherManager blockFetcherManager)
 {
     _logger = logger;
     _blockFetcherManager = blockFetcherManager;
 }