pub fn from_raw_psbt(raw_psbt: &[u8]) -> Result<Self, TransactionSerialisationError> {
        let psbt = Decodable::consensus_decode(raw_psbt)?;
        let psbt = utils::psbt_common_sanity_checks(psbt)?;

        // Deposit txo
        let output_count = psbt.global.unsigned_tx.output.len();
        if output_count != 1 {
            return Err(PsbtValidationError::InvalidOutputCount(output_count).into());
        }

        for output in psbt.outputs.iter() {
            if output.bip32_derivation.is_empty() {
                return Err(PsbtValidationError::InvalidOutputField(output.clone()).into());
            }
        }

        // Deposit txo is P2WSH
        let output = &psbt.outputs[0];
        if output.redeem_script.is_some() {
            return Err(PsbtValidationError::InvalidOutputField(output.clone()).into());
        }

        let input_count = psbt.global.unsigned_tx.input.len();
        if input_count > 2 {
            return Err(PsbtValidationError::InvalidInputCount(input_count).into());
        }
        if input_count > 1 {
            let input = utils::find_feebumping_input(&psbt.inputs)
                .ok_or(PsbtValidationError::MissingFeeBumpingInput)?;
            utils::check_feebump_input(&input)?;
        }
        let input = utils::find_revocationtx_input(&psbt.inputs)
            .ok_or(PsbtValidationError::MissingRevocationInput)?;
        utils::check_revocationtx_input(&input)?;

        Ok(CancelTransaction(psbt))
    }
/// Parse a Cancel transaction from a PSBT
Parse a Cancel transaction from a PSBT
Parse a Cancel transaction from a PSBT
pub fn from_raw_psbt(raw_psbt: &[u8]) -> Result<Self, TransactionSerialisationError> {
        let psbt = Decodable::consensus_decode(raw_psbt)?;
        let psbt = utils::psbt_common_sanity_checks(psbt)?;
        // Deposit txo
        let output_count = psbt.global.unsigned_tx.output.len();
        if output_count != 1 {
            return Err(PsbtValidationError::InvalidOutputCount(output_count).into());
        }
        for output in psbt.outputs.iter() {
            if output.bip32_derivation.is_empty() {
                return Err(PsbtValidationError::InvalidOutputField(output.clone()).into());
            }
        }
        // Deposit txo is P2WSH
        let output = &psbt.outputs[0];
        if output.redeem_script.is_some() {
            return Err(PsbtValidationError::InvalidOutputField(output.clone()).into());
        }
        let input_count = psbt.global.unsigned_tx.input.len();
        if input_count > 2 {
            return Err(PsbtValidationError::InvalidInputCount(input_count).into());
        }
        if input_count > 1 {
            let input = utils::find_feebumping_input(&psbt.inputs)
                .ok_or(PsbtValidationError::MissingFeeBumpingInput)?;
            utils::check_feebump_input(&input)?;
        }
        let input = utils::find_revocationtx_input(&psbt.inputs)
            .ok_or(PsbtValidationError::MissingRevocationInput)?;
        utils::check_revocationtx_input(&input)?;
        Ok(CancelTransaction(psbt))
    }
pub fn from_raw_psbt ( raw_psbt : & [ u8 ] ) -> Result < Self , TransactionSerialisationError > { let psbt = Decodable :: consensus_decode ( raw_psbt ) ? ; let psbt = utils :: psbt_common_sanity_checks ( psbt ) ? ; // Deposit txo let output_count = psbt . global . unsigned_tx . output . len ( ) ; if output_count != 1 { return Err ( PsbtValidationError :: InvalidOutputCount ( output_count ) . into ( ) ) ; } for output in psbt . outputs . iter ( ) { if output . bip32_derivation . is_empty ( ) { return Err ( PsbtValidationError :: InvalidOutputField ( output . clone ( ) ) . into ( ) ) ; } } // Deposit txo is P2WSH let output = & psbt . outputs [ 0 ] ; if output . redeem_script . is_some ( ) { return Err ( PsbtValidationError :: InvalidOutputField ( output . clone ( ) ) . into ( ) ) ; } let input_count = psbt . global . unsigned_tx . input . len ( ) ; if input_count > 2 { return Err ( PsbtValidationError :: InvalidInputCount ( input_count ) . into ( ) ) ; } if input_count > 1 { let input = utils :: find_feebumping_input ( & psbt . inputs ) . ok_or ( PsbtValidationError :: MissingFeeBumpingInput ) ? ; utils :: check_feebump_input ( & input ) ? ; } let input = utils :: find_revocationtx_input ( & psbt . inputs ) . ok_or ( PsbtValidationError :: MissingRevocationInput ) ? ; utils :: check_revocationtx_input ( & input ) ? ; Ok ( CancelTransaction ( psbt ) ) }
Parse a Cancel transaction from a PSBT
Parse a Cancel transaction from a PSBT
raw_psbt
&[u8]