pub fn try_key_as_xpub<E>(key: &PSBTKey) -> Result<XPub, PSBTError>
where
    E: XKeyEncoder,
{
    if key.len() < 2 {
        return Err(Bip32Error::BadXPubVersionBytes([0u8; 4]).into());
    }
    // strip off first byte (the type)
    let mut xpub_bytes = &key.items()[1..];
    Ok(E::read_xpub(&mut xpub_bytes)?)
}
/// Attempt to parse a key as a valid extended pubkey
Attempt to parse a key as a valid extended pubkey
Attempt to parse a key as a valid extended pubkey
pub fn try_key_as_xpub<E>(key: &PSBTKey) -> Result<XPub, PSBTError>
where
    E: XKeyEncoder,
{
    if key.len() < 2 {
        return Err(Bip32Error::BadXPubVersionBytes([0u8; 4]).into());
    }
    // strip off first byte (the type)
    let mut xpub_bytes = &key.items()[1..];
    Ok(E::read_xpub(&mut xpub_bytes)?)
}
pub fn try_key_as_xpub < E > ( key : & PSBTKey ) -> Result < XPub , PSBTError > where E : XKeyEncoder , { if key . len ( ) < 2 { return Err ( Bip32Error :: BadXPubVersionBytes ( [ 0u8 ; 4 ] ) . into ( ) ) ; } // strip off first byte (the type) let mut xpub_bytes = & key . items ( ) [ 1 .. ] ; Ok ( E :: read_xpub ( & mut xpub_bytes ) ? ) }
Attempt to parse a key as a valid extended pubkey
Attempt to parse a key as a valid extended pubkey
key
&PSBTKey
key
&PSBTKey