Skip to main content

validate_no_empty_origin_overrides

Function validate_no_empty_origin_overrides 

Source
pub fn validate_no_empty_origin_overrides(d: &Descriptor) -> Result<(), Error>
Expand description

Validate that no OriginPathOverrides[idx] entry is present-but-empty (zero path components). Per spec v0.13 §6.3 (I-1 hardening, P0 pathless/dead-card partial-decode).

Runs UNCONDITIONALLY — regardless of canonical_origin(&d.tree) — so a CANONICAL-shape wire (e.g. wpkh(@0)) carrying an empty override is ALSO rejected (I-1a). This is a DISTINCT error variant from Error::MissingExplicitOrigin so partial-allowing decode (P0.2, which swallows ONLY MissingExplicitOrigin) never swallows this: a present-but-empty override is a MALFORMED wire, not a dead card, and must not partial-render (I-1b, fatal-in-partial).

Converges with crate::canonicalize::expand_per_at_n, which runs the same check independently (defense in depth for a hand-built Descriptor that bypasses decode).