/// <summary>
        /// Initializes an instance of the object.
        /// </summary>
        public ConsensusRuleDescriptor(ConsensusRule rule)
        {
            this.Rule       = rule;
            this.Attributes = Attribute.GetCustomAttributes(rule.GetType()).OfType <RuleAttribute>().ToList();

            this.validationRuleAttribute = this.Attributes.OfType <ValidationRuleAttribute>().FirstOrDefault();
        }
        public void SetErrorHandler(ConsensusRule errorHandler)
        {
            // TODO: set a rule that will be invoked when a validation of a block failed.

            // This will allow the creator of the blockchain to provide
            // an error handler rule that is unique to the current blockchain.
            // future sidechains may have additional handling of errors that
            // extend or replace the default current error handling code.
        }
        /// <summary>
        /// Initializes an instance of the object.
        /// </summary>
        public ConsensusRuleDescriptor(ConsensusRule rule)
        {
            Guard.NotNull(rule, nameof(rule));

            this.Rule           = rule;
            this.RuleAttributes = Attribute.GetCustomAttributes(rule.GetType()).OfType <RuleAttribute>().ToList();

            var validationRuleAttribute = this.RuleAttributes.OfType <ValidationRuleAttribute>().FirstOrDefault();

            this.CanSkipValidation = validationRuleAttribute?.CanSkipValidation ?? !this.RuleAttributes.Any();
        }