Skip to main content

validate_presence_byte

Function validate_presence_byte 

Source
pub fn validate_presence_byte(byte: u8) -> Result<(), Error>
Expand description

Validate a presence_byte from a WalletPolicyId canonical-record preimage (spec v0.13 §5.3). Bit 0 = fp_present, bit 1 = xpub_present, bits 2..7 reserved (must be 0). Returns Error::InvalidPresenceByte with the offending reserved-bit field if any of bits 2..7 is set.

v0.13’s encoder masks reserved bits when building the preimage, so this helper is unreachable on v0.13 wire today. It enforces the spec §5.3 “decoders MUST reject” clause for any future canonical-record consumer (e.g., a verification-mode tool that reconstructs the preimage to cross-check a WalletPolicyId).