| 99 | } |
| 100 | |
| 101 | fn serialize_txin<W: borsh::io::Write>(txin: &TxIn, writer: &mut W) -> borsh::io::Result<()> { |
| 102 | BorshSerialize::serialize(&txin.previous_output.txid.to_byte_array(), writer)?; |
| 103 | BorshSerialize::serialize(&txin.previous_output.vout, writer)?; |
| 104 | BorshSerialize::serialize(&txin.script_sig.as_bytes(), writer)?; |
| 105 | BorshSerialize::serialize(&txin.sequence.0, writer)?; |
| 106 | BorshSerialize::serialize(&txin.witness.to_vec(), writer) |
| 107 | } |
| 108 | |
| 109 | fn deserialize_txin<R: borsh::io::Read>(reader: &mut R) -> borsh::io::Result<TxIn> { |
| 110 | let txid = bitcoin::Txid::from_byte_array(<[u8; 32]>::deserialize_reader(reader)?); |