Skip to main content

validate_placeholder_usage

Function validate_placeholder_usage 

Source
pub fn validate_placeholder_usage(root: &Node, n: u8) -> Result<(), Error>
Expand description

Validate the BIP 388 well-formedness of placeholder usage in the tree.

Enforces two invariants:

  1. Every @i for 0 ≤ i < n appears at least once in the tree.
  2. The first occurrences (in pre-order traversal) of distinct placeholder indices appear in canonical ascending order: @0 before @1 before @2, etc.