/// <summary>
        /// Initializes an instance of the object.
        /// </summary>
        public ConsensusRuleDescriptor(ConsensusRule rule, RuleAttribute attribute)
        {
            Guard.NotNull(rule, nameof(rule));

            this.Rule          = rule;
            this.RuleAttribute = attribute;
        }
        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.
        }
Exemple #3
0
        /// <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();

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

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