pub fn validate_xpub_depth(key: &PSBTKey, val: &PSBTValue) -> Result<(), PSBTError> {
    let expected = (val.len() / 4) - 1;
    if let Some(depth) = key.items().get(4) {
        if expected == *depth as usize {
            Ok(())
        } else {
            Err(PSBTError::Bip32DepthMismatch)
        }
    } else {
        Err(PSBTError::Bip32DepthMismatch)
    }
}
/// Compares an xpub key to its derivation, and ensure the depth marker matches tne stated
/// derivation depth
Compares an xpub key to its derivation, and ensure the depth marker matches tne stated
derivation depth
Compares an xpub key to its derivation and ensure the depth marker matches tne stated derivation depth
pub fn validate_xpub_depth(key: &PSBTKey, val: &PSBTValue) -> Result<(), PSBTError> {
    let expected = (val.len() / 4) - 1;
    if let Some(depth) = key.items().get(4) {
        if expected == *depth as usize {
            Ok(())
        } else {
            Err(PSBTError::Bip32DepthMismatch)
        }
    } else {
        Err(PSBTError::Bip32DepthMismatch)
    }
}
pub fn validate_xpub_depth ( key : & PSBTKey , val : & PSBTValue ) -> Result < ( ) , PSBTError > { let expected = ( val . len ( ) / 4 ) - 1 ; if let Some ( depth ) = key . items ( ) . get ( 4 ) { if expected == * depth as usize { Ok ( ( ) ) } else { Err ( PSBTError :: Bip32DepthMismatch ) } } else { Err ( PSBTError :: Bip32DepthMismatch ) } }
Compares an xpub key to its derivation, and ensure the depth marker matches tne stated
derivation depth
Compares an xpub key to its derivation and ensure the depth marker matches tne stated derivation depth
key
&PSBTKey
val
&PSBTValue
key
&PSBTKey
val
&PSBTValue