/// TODO: this method needs to be deleted once all rules use dependency injection /// <inheritdoc /> public ConsensusRuleEngine SetupRulesEngineParent() { this.SetupConsensusRules(this.consensusRules.HeaderValidationRules.Select(x => x as ConsensusRuleBase)); this.SetupConsensusRules(this.consensusRules.IntegrityValidationRules.Select(x => x as ConsensusRuleBase)); this.SetupConsensusRules(this.consensusRules.PartialValidationRules.Select(x => x as ConsensusRuleBase)); this.SetupConsensusRules(this.consensusRules.FullValidationRules.Select(x => x as ConsensusRuleBase)); // Registers all rules that might be executed to the performance counter. this.performanceCounter = new ConsensusRulesPerformanceCounter(this.consensusRules); return(this); }
/// <inheritdoc /> public ConsensusRuleEngine Register() { this.headerValidationRules = this.Network.Consensus.HeaderValidationRules.Select(x => x as HeaderValidationConsensusRule).ToList(); this.SetupConsensusRules(this.headerValidationRules.Select(x => x as ConsensusRuleBase)); this.integrityValidationRules = this.Network.Consensus.IntegrityValidationRules.Select(x => x as IntegrityValidationConsensusRule).ToList(); this.SetupConsensusRules(this.integrityValidationRules.Select(x => x as ConsensusRuleBase)); this.partialValidationRules = this.Network.Consensus.PartialValidationRules.Select(x => x as PartialValidationConsensusRule).ToList(); this.SetupConsensusRules(this.partialValidationRules.Select(x => x as ConsensusRuleBase)); this.fullValidationRules = this.Network.Consensus.FullValidationRules.Select(x => x as FullValidationConsensusRule).ToList(); this.SetupConsensusRules(this.fullValidationRules.Select(x => x as ConsensusRuleBase)); // Registers all rules that might be executed to the performance counter. this.performanceCounter = new ConsensusRulesPerformanceCounter(this.Network.Consensus); return(this); }