public TargetChainWorker(WorkerConfig workerConfig, Logger logger, IKernel kernel, IBlockchainRules rules, ChainedHeaderCache chainedHeaderCache, InvalidBlockCache invalidBlockCache) : base("TargetChainWorker", workerConfig.initialNotify, workerConfig.minIdleTime, workerConfig.maxIdleTime, logger) { this.logger = logger; this.rules = rules; this.chainedHeaderCache = chainedHeaderCache; this.invalidBlockCache = invalidBlockCache; this.rescanEvent = new AutoResetEvent(false); this.targetBlockWorker = kernel.Get <TargetBlockWorker>( new ConstructorArgument("workerConfig", new WorkerConfig(initialNotify: true, minIdleTime: TimeSpan.Zero, maxIdleTime: TimeSpan.MaxValue))); this.targetBlockWorker.OnTargetBlockChanged += HandleTargetBlockChanged; this.chainedHeaderCache.OnAddition += HandleChainedHeader; this.invalidBlockCache.OnAddition += HandleInvalidBlock; }
public TargetBlockWorker(WorkerConfig workerConfig, Logger logger, ChainedHeaderCache chainedHeaderCache, InvalidBlockCache invalidBlockCache) : base("TargetBlockWorker", workerConfig.initialNotify, workerConfig.minIdleTime, workerConfig.maxIdleTime, logger) { this.chainedHeaderCache = chainedHeaderCache; this.invalidBlockCache = invalidBlockCache; this.targetBlock = null; this.targetBlockLock = new ReaderWriterLockSlim(); this.chainedHeaderQueue = new ConcurrentQueue <ChainedHeader>(); this.rescanEvent = new AutoResetEvent(false); // wire up cache events this.chainedHeaderCache.OnAddition += CheckChainedHeader; this.invalidBlockCache.OnAddition += HandleInvalidBlock; }
public ChainStateWorker(TargetChainWorker targetChainWorker, ChainStateBuilder chainStateBuilder, Func <Chain> getTargetChain, WorkerConfig workerConfig, Logger logger, IKernel kernel, IBlockchainRules rules, BlockCache blockCache, SpentTransactionsCache spentTransactionsCache, InvalidBlockCache invalidBlockCache) : base("ChainStateWorker", workerConfig.initialNotify, workerConfig.minIdleTime, workerConfig.maxIdleTime, logger) { this.logger = logger; this.getTargetChain = getTargetChain; this.kernel = kernel; this.rules = rules; this.blockCache = blockCache; this.spentTransactionsCache = spentTransactionsCache; this.invalidBlockCache = invalidBlockCache; this.blockProcessingDurationMeasure = new DurationMeasure(); this.targetChainWorker = targetChainWorker; this.chainStateBuilder = chainStateBuilder; this.currentChain = this.chainStateBuilder.Chain.ToImmutable(); this.pruningWorker = kernel.Get <PruningWorker>( new ConstructorArgument("workerConfig", new WorkerConfig(initialNotify: false, minIdleTime: TimeSpan.FromSeconds(30), maxIdleTime: TimeSpan.FromMinutes(5))), new ConstructorArgument("getChainStateBuilder", (Func <ChainStateBuilder>)(() => this.chainStateBuilder))); }