pub fn try_val_as_sighash(val: &PSBTValue) -> Result<Sighash, PSBTError> {
    validate_fixed_val_length(val, 4)?;
    let mut buf = [0u8; 4];
    buf.copy_from_slice(&val.items()[..4]);
    let sighash = u32::from_le_bytes(buf);
    if sighash > 0xff {
        // bits higher than the first byte should be empty
        return Err(TxError::UnknownSighash(0xff).into());
    }
    Ok(Sighash::from_u8(sighash as u8)?)
}
/// Attempt to deserialize a value as a sighash flag
Attempt to deserialize a value as a sighash flag
Attempt to deserialize a value as a sighash flag
pub fn try_val_as_sighash(val: &PSBTValue) -> Result<Sighash, PSBTError> {
    validate_fixed_val_length(val, 4)?;
    let mut buf = [0u8; 4];
    buf.copy_from_slice(&val.items()[..4]);
    let sighash = u32::from_le_bytes(buf);
    if sighash > 0xff {
        // bits higher than the first byte should be empty
        return Err(TxError::UnknownSighash(0xff).into());
    }
    Ok(Sighash::from_u8(sighash as u8)?)
}
pub fn try_val_as_sighash ( val : & PSBTValue ) -> Result < Sighash , PSBTError > { validate_fixed_val_length ( val , 4 ) ? ; let mut buf = [ 0u8 ; 4 ] ; buf . copy_from_slice ( & val . items ( ) [ .. 4 ] ) ; let sighash = u32 :: from_le_bytes ( buf ) ; if sighash > 0xff { // bits higher than the first byte should be empty return Err ( TxError :: UnknownSighash ( 0xff ) . into ( ) ) ; } Ok ( Sighash :: from_u8 ( sighash as u8 ) ? ) }
Attempt to deserialize a value as a sighash flag
Attempt to deserialize a value as a sighash flag
val
&PSBTValue
val
&PSBTValue