FUNCTION

validate_rule

function validate_rule(rule: rule_expression)

Checks that the rule is sensible. This means that the rule does not expect:

  • block height or timestamp to be negative
  • op_count to be zero or negative

It also rejects op_count rules with operators that are not lt or le.

Throws "INVALID RULE" if:

  • the rule variable is block_height and the value is less than 0
  • the rule variable is block_time and the value is less than 0
  • the rule variable is block_height and the operator is neither of lt and le
  • the rule variable is op_count but the requirement would never be satisfied, i.e.:
    • op_count, lt, any value below two
    • op_count, le, any value below one

The first authentication attempt will be checked against an op_count value of 1, not 0.

Parameters

  • rule — the rule to check
© 2024 Chromia