/// Read a `TransferTransaction` from a `reader` of bytes and return it.
Read a `TransferTransaction` from a `reader` of bytes and return it.
Read a ` TransferTransaction ` from a ` reader ` of bytes and return it .
fn from_u8<R: Read>(mut reader: R) -> std::io::Result<Self> {
        let mut option = [0; 1];
        let mut rt_cred = [0; 32];
        let mut rt_note = [0; 32];
        let mut rt_mem = [0; 32];
        let mut eta: NoteNullifier = [0; 32];
        let mut mu: MemoryNullifier = [0; 32];
        let mut cm_note_new = [0; 32];
        let mut cm_mem_new = [0; 32];
        let mut t_new = [0; 8];
        let mut k: SignatureKeyHash = [0; 32];
        let mut kappa: SignatureKeyLink = [0; 32];
        let mut data_note_len = [0; 8];
        let mut data_note = vec![];
        let mut epk_note = [0; 32];
        let mut data_mem_len = [0; 8];
        let mut data_mem = vec![];
        let mut epk_mem = [0; 32];
        reader.read_exact(&mut rt_cred)?;
        let rt_cred = fr_from_repr(rt_cred)?;
        reader.read_exact(&mut option)?;
        let rt_note = match option[0] {
            0 => None,
            1 => {
                reader.read_exact(&mut rt_note)?;
                Some(fr_from_repr(rt_note)?)
            }
            _ => {
                return Err(std::io::Error::new(
                    std::io::ErrorKind::Other,
                    "Invalid rt_note option.",
                ))
            }
        };
        reader.read_exact(&mut rt_mem)?;
        let rt_mem = fr_from_repr(rt_mem)?;
        reader.read_exact(&mut option)?;
        let eta = match option[0] {
            0 => None,
            1 => {
                reader.read_exact(&mut eta)?;
                Some(eta)
            }
            _ => {
                return Err(std::io::Error::new(
                    std::io::ErrorKind::Other,
                    "Invalid eta option.",
                ))
            }
        };
        reader.read_exact(&mut mu)?;
        reader.read_exact(&mut cm_note_new)?;
        let cm_note_new = fr_from_repr(cm_note_new)?;
        reader.read_exact(&mut cm_mem_new)?;
        let cm_mem_new = fr_from_repr(cm_mem_new)?;
        reader.read_exact(&mut t_new)?;
        let t_new = TransactionTime(t_new);
        reader.read_exact(&mut k)?;
        reader.read_exact(&mut kappa)?;
        reader.read_exact(&mut data_note_len)?;
        let data_note_len = u8_array_to_u64(&data_note_len);
        for _ in 0..data_note_len {
            let mut byte = [0; 1];
            reader.read_exact(&mut byte)?;
            data_note.push(byte[0])
        }
        reader.read_exact(&mut epk_note)?;
        let epk_note = UnparsedPublicKey::new(&X25519, epk_note);
        reader.read_exact(&mut data_mem_len)?;
        let data_mem_len = u8_array_to_u64(&data_mem_len);
        for _ in 0..data_mem_len {
            let mut byte = [0; 1];
            reader.read_exact(&mut byte)?;
            data_mem.push(byte[0])
        }
        reader.read_exact(&mut epk_mem)?;
        let epk_mem = UnparsedPublicKey::new(&X25519, epk_mem);
        let data_saver = SaverCiphertext::<Bls12>::read(reader.by_ref())?;
        let proof = Proof::<Bls12>::read(reader.by_ref())?;
        let mut vec_len = [0; 8];
        reader.read_exact(&mut vec_len)?;
        let mut pk_sig = vec![0; u8_array_to_u64(&vec_len) as usize];
        reader.read_exact(&mut pk_sig)?;
        reader.read_exact(&mut vec_len)?;
        let mut signature = vec![0; u8_array_to_u64(&vec_len) as usize];
        reader.read_exact(&mut signature)?;
        Ok(TransferTransaction {
            rt_cred,
            rt_note,
            rt_mem,
            eta,
            mu,
            cm_note_new,
            cm_mem_new,
            t_new,
            k,
            kappa,
            data_note,
            epk_note,
            data_mem,
            epk_mem,
            data_saver,
            proof,
            pk_sig,
            signature,
        })
    }
fn from_u8 < R : Read > ( mut reader : R ) -> std :: io :: Result < Self > { let mut option = [ 0 ; 1 ] ; let mut rt_cred = [ 0 ; 32 ] ; let mut rt_note = [ 0 ; 32 ] ; let mut rt_mem = [ 0 ; 32 ] ; let mut eta : NoteNullifier = [ 0 ; 32 ] ; let mut mu : MemoryNullifier = [ 0 ; 32 ] ; let mut cm_note_new = [ 0 ; 32 ] ; let mut cm_mem_new = [ 0 ; 32 ] ; let mut t_new = [ 0 ; 8 ] ; let mut k : SignatureKeyHash = [ 0 ; 32 ] ; let mut kappa : SignatureKeyLink = [ 0 ; 32 ] ; let mut data_note_len = [ 0 ; 8 ] ; let mut data_note = vec ! [ ] ; let mut epk_note = [ 0 ; 32 ] ; let mut data_mem_len = [ 0 ; 8 ] ; let mut data_mem = vec ! [ ] ; let mut epk_mem = [ 0 ; 32 ] ; reader . read_exact ( & mut rt_cred ) ? ; let rt_cred = fr_from_repr ( rt_cred ) ? ; reader . read_exact ( & mut option ) ? ; let rt_note = match option [ 0 ] { 0 => None , 1 => { reader . read_exact ( & mut rt_note ) ? ; Some ( fr_from_repr ( rt_note ) ? ) } _ => { return Err ( std :: io :: Error :: new ( std :: io :: ErrorKind :: Other , " " , ) ) } } ; reader . read_exact ( & mut rt_mem ) ? ; let rt_mem = fr_from_repr ( rt_mem ) ? ; reader . read_exact ( & mut option ) ? ; let eta = match option [ 0 ] { 0 => None , 1 => { reader . read_exact ( & mut eta ) ? ; Some ( eta ) } _ => { return Err ( std :: io :: Error :: new ( std :: io :: ErrorKind :: Other , " " , ) ) } } ; reader . read_exact ( & mut mu ) ? ; reader . read_exact ( & mut cm_note_new ) ? ; let cm_note_new = fr_from_repr ( cm_note_new ) ? ; reader . read_exact ( & mut cm_mem_new ) ? ; let cm_mem_new = fr_from_repr ( cm_mem_new ) ? ; reader . read_exact ( & mut t_new ) ? ; let t_new = TransactionTime ( t_new ) ; reader . read_exact ( & mut k ) ? ; reader . read_exact ( & mut kappa ) ? ; reader . read_exact ( & mut data_note_len ) ? ; let data_note_len = u8_array_to_u64 ( & data_note_len ) ; for _ in 0 .. data_note_len { let mut byte = [ 0 ; 1 ] ; reader . read_exact ( & mut byte ) ? ; data_note . push ( byte [ 0 ] ) } reader . read_exact ( & mut epk_note ) ? ; let epk_note = UnparsedPublicKey :: new ( & X25519 , epk_note ) ; reader . read_exact ( & mut data_mem_len ) ? ; let data_mem_len = u8_array_to_u64 ( & data_mem_len ) ; for _ in 0 .. data_mem_len { let mut byte = [ 0 ; 1 ] ; reader . read_exact ( & mut byte ) ? ; data_mem . push ( byte [ 0 ] ) } reader . read_exact ( & mut epk_mem ) ? ; let epk_mem = UnparsedPublicKey :: new ( & X25519 , epk_mem ) ; let data_saver = SaverCiphertext :: < Bls12 > :: read ( reader . by_ref ( ) ) ? ; let proof = Proof :: < Bls12 > :: read ( reader . by_ref ( ) ) ? ; let mut vec_len = [ 0 ; 8 ] ; reader . read_exact ( & mut vec_len ) ? ; let mut pk_sig = vec ! [ 0 u8_array_to_u64 ( vec_len ) as usize ] ; reader . read_exact ( & mut pk_sig ) ? ; reader . read_exact ( & mut vec_len ) ? ; let mut signature = vec ! [ 0 u8_array_to_u64 ( vec_len ) as usize ] ; reader . read_exact ( & mut signature ) ? ; Ok ( TransferTransaction { rt_cred , rt_note , rt_mem , eta , mu , cm_note_new , cm_mem_new , t_new , k , kappa , data_note , epk_note , data_mem , epk_mem , data_saver , proof , pk_sig , signature , } ) }
Read a `TransferTransaction` from a `reader` of bytes and return it.
Read a ` TransferTransaction ` from a ` reader ` of bytes and return it .
reader
R