} Some(_) => return Ok(None), } } } } #[cfg(test)] mod tests { use {super::*, bitcoin::absolute::LockTime}; fn parse(witnesses: &[Witness]) -> Vec { ParsedEnvelope::from_transaction(&Transaction { version: 0, lock_time: LockTime::ZERO, input: witnesses .iter() .map(|witness| TxIn { previous_output: OutPoint::null(), script_sig: ScriptBuf::new(), sequence: Sequence::ENABLE_RBF_NO_LOCKTIME, witness: witness.clone(), }) .collect(), output: Vec::new(), }) } #[test] fn empty() { assert_eq!(parse(&[Witness::new()]), Vec::new()) } #[test] fn ignore_key_path_spends() { assert_eq!( parse(&[Witness::from_slice(&[bitcoin::script::Builder::new() .push_opcode(bitcoin::opcodes::OP_FALSE) .push_opcode(bitcoin::opcodes::all::OP_IF) .push_slice(b"ord") .push_opcode(bitcoin::opcodes::all::OP_ENDIF) .into_script()