Exemplo n.º 1
0
        public BodiesSyncFeed(
            ISyncModeSelector syncModeSelector,
            IBlockTree blockTree,
            ISyncPeerPool syncPeerPool,
            ISyncConfig syncConfig,
            ISyncReport syncReport,
            ISpecProvider specProvider,
            ILogManager logManager) : base(syncModeSelector)
        {
            _logger       = logManager?.GetClassLogger() ?? throw new ArgumentNullException(nameof(logManager));
            _blockTree    = blockTree ?? throw new ArgumentNullException(nameof(blockTree));
            _syncPeerPool = syncPeerPool ?? throw new ArgumentNullException(nameof(syncPeerPool));
            _syncConfig   = syncConfig ?? throw new ArgumentNullException(nameof(syncConfig));
            _syncReport   = syncReport ?? throw new ArgumentNullException(nameof(syncReport));
            _specProvider = specProvider ?? throw new ArgumentNullException(nameof(specProvider));

            if (!_syncConfig.FastBlocks)
            {
                throw new InvalidOperationException(
                          "Entered fast blocks mode without fast blocks enabled in configuration.");
            }

            _pivotNumber = _syncConfig.PivotNumberParsed;
            _barrier     = _barrier = _syncConfig.AncientBodiesBarrierCalc;
            if (_logger.IsInfo)
            {
                _logger.Info($"Using pivot {_pivotNumber} and barrier {_barrier} in bodies sync");
            }

            _syncStatusList = new SyncStatusList(
                _blockTree,
                _pivotNumber,
                _blockTree.LowestInsertedBodyNumber);
        }
Exemplo n.º 2
0
        public ReceiptsSyncFeed(
            ISyncModeSelector syncModeSelector,
            ISpecProvider specProvider,
            IBlockTree blockTree,
            IReceiptStorage receiptStorage,
            ISyncPeerPool syncPeerPool,
            ISyncConfig syncConfig,
            ISyncReport syncReport,
            ILogManager logManager)
            : base(syncModeSelector)
        {
            _logger         = logManager?.GetClassLogger() ?? throw new ArgumentNullException(nameof(logManager));
            _receiptStorage = receiptStorage ?? throw new ArgumentNullException(nameof(receiptStorage));
            _specProvider   = specProvider ?? throw new ArgumentNullException(nameof(specProvider));
            _syncPeerPool   = syncPeerPool ?? throw new ArgumentNullException(nameof(syncPeerPool));
            _syncConfig     = syncConfig ?? throw new ArgumentNullException(nameof(syncConfig));
            _syncReport     = syncReport ?? throw new ArgumentNullException(nameof(syncReport));
            _blockTree      = blockTree ?? throw new ArgumentNullException(nameof(blockTree));

            if (!_syncConfig.FastBlocks)
            {
                throw new InvalidOperationException("Entered fast blocks mode without fast blocks enabled in configuration.");
            }

            _pivotNumber    = _syncConfig.PivotNumberParsed;
            _syncStatusList = new SyncStatusList(
                _blockTree,
                _pivotNumber,
                _receiptStorage.LowestInsertedReceiptBlockNumber);
        }