public BlockDownloader(
            ISyncFeed <BlocksRequest> feed,
            ISyncPeerPool syncPeerPool,
            IBlockTree blockTree,
            IBlockValidator blockValidator,
            ISealValidator sealValidator,
            ISyncReport syncReport,
            IReceiptStorage receiptStorage,
            ISpecProvider specProvider,
            ILogManager logManager)
            : base(feed, syncPeerPool, new BlocksSyncPeerAllocationStrategyFactory(), logManager)
        {
            _blockTree      = blockTree ?? throw new ArgumentNullException(nameof(blockTree));
            _blockValidator = blockValidator ?? throw new ArgumentNullException(nameof(blockValidator));
            _sealValidator  = sealValidator ?? throw new ArgumentNullException(nameof(sealValidator));
            _syncReport     = syncReport ?? throw new ArgumentNullException(nameof(syncReport));
            _receiptStorage = receiptStorage ?? throw new ArgumentNullException(nameof(receiptStorage));
            _specProvider   = specProvider ?? throw new ArgumentNullException(nameof(specProvider));
            _logger         = logManager.GetClassLogger() ?? throw new ArgumentNullException(nameof(logManager));

            _syncBatchSize           = new SyncBatchSize(logManager);
            _blockTree.NewHeadBlock += BlockTreeOnNewHeadBlock;
        }
Esempio n. 2
0
        public BlockDownloader(
            ISyncFeed <BlocksRequest?>?feed,
            ISyncPeerPool?syncPeerPool,
            IBlockTree?blockTree,
            IBlockValidator?blockValidator,
            ISealValidator?sealValidator,
            ISyncReport?syncReport,
            IReceiptStorage?receiptStorage,
            ISpecProvider?specProvider,
            ILogManager?logManager)
            : base(feed, syncPeerPool, new BlocksSyncPeerAllocationStrategyFactory(), logManager)
        {
            _blockTree      = blockTree ?? throw new ArgumentNullException(nameof(blockTree));
            _blockValidator = blockValidator ?? throw new ArgumentNullException(nameof(blockValidator));
            _sealValidator  = sealValidator ?? throw new ArgumentNullException(nameof(sealValidator));
            _syncReport     = syncReport ?? throw new ArgumentNullException(nameof(syncReport));
            _receiptStorage = receiptStorage ?? throw new ArgumentNullException(nameof(receiptStorage));
            _specProvider   = specProvider ?? throw new ArgumentNullException(nameof(specProvider));
            _logger         = logManager?.GetClassLogger() ?? throw new ArgumentNullException(nameof(logManager));

            _receiptsRecovery        = new ReceiptsRecovery(new EthereumEcdsa(_specProvider.ChainId, logManager), _specProvider);
            _syncBatchSize           = new SyncBatchSize(logManager);
            _blockTree.NewHeadBlock += BlockTreeOnNewHeadBlock;
        }