fn deserialize_version_with_time(time: i64) -> Result<Message, Error> {
        let rt = zebra_test::init_async();

        let v = &*VERSION_TEST_VECTOR;

        use tokio_util::codec::{FramedRead, FramedWrite};
        let v_bytes = rt.block_on(async {
            let mut bytes = Vec::new();
            {
                let mut fw = FramedWrite::new(&mut bytes, Codec::builder().finish());
                fw.send(v.clone())
                    .await
                    .expect("message should be serialized");
            }

            let old_bytes = bytes.clone();

            // tweak the version bytes so the timestamp is set to `time`
            // Version serialization is specified at:
            // https://developer.bitcoin.org/reference/p2p_networking.html#version
            bytes[36..44].copy_from_slice(&time.to_le_bytes());

            // Checksum is specified at:
            // https://developer.bitcoin.org/reference/p2p_networking.html#message-headers
            let checksum = sha256d::Checksum::from(&bytes[HEADER_LEN..]);
            bytes[20..24].copy_from_slice(&checksum.0);

            debug!(?time,
                   old_len = ?old_bytes.len(), new_len = ?bytes.len(),
                   old_bytes = ?&old_bytes[36..44], new_bytes = ?&bytes[36..44]);

            bytes
        });

        rt.block_on(async {
            let mut fr = FramedRead::new(Cursor::new(&v_bytes), Codec::builder().finish());
            fr.next().await.expect("a next message should be available")
        })
    }
/// Deserialize a `Version` message containing `time`, and return the result.
Deserialize a `Version` message containing `time`, and return the result.
Deserialize a ` Version ` message containing ` time ` and return the result .
fn deserialize_version_with_time(time: i64) -> Result<Message, Error> {
        let rt = zebra_test::init_async();
        let v = &*VERSION_TEST_VECTOR;
        use tokio_util::codec::{FramedRead, FramedWrite};
        let v_bytes = rt.block_on(async {
            let mut bytes = Vec::new();
            {
                let mut fw = FramedWrite::new(&mut bytes, Codec::builder().finish());
                fw.send(v.clone())
                    .await
                    .expect("message should be serialized");
            }
            let old_bytes = bytes.clone();
            // tweak the version bytes so the timestamp is set to `time`
            // Version serialization is specified at:
            // https://developer.bitcoin.org/reference/p2p_networking.html#version
            bytes[36..44].copy_from_slice(&time.to_le_bytes());
            // Checksum is specified at:
            // https://developer.bitcoin.org/reference/p2p_networking.html#message-headers
            let checksum = sha256d::Checksum::from(&bytes[HEADER_LEN..]);
            bytes[20..24].copy_from_slice(&checksum.0);
            debug!(?time,
                   old_len = ?old_bytes.len(), new_len = ?bytes.len(),
                   old_bytes = ?&old_bytes[36..44], new_bytes = ?&bytes[36..44]);
            bytes
        });
        rt.block_on(async {
            let mut fr = FramedRead::new(Cursor::new(&v_bytes), Codec::builder().finish());
            fr.next().await.expect("a next message should be available")
        })
    }
fn deserialize_version_with_time ( time : i64 ) -> Result < Message , Error > { let rt = zebra_test :: init_async ( ) ; let v = & * VERSION_TEST_VECTOR ; use tokio_util :: codec :: { FramedRead , FramedWrite } ; let v_bytes = rt . block_on ( async { let mut bytes = Vec :: new ( ) ; { let mut fw = FramedWrite :: new ( & mut bytes , Codec :: builder ( ) . finish ( ) ) ; fw . send ( v . clone ( ) ) . await . expect ( " " ) ; } let old_bytes = bytes . clone ( ) ; // tweak the version bytes so the timestamp is set to `time` // Version serialization is specified at: // https://developer.bitcoin.org/reference/p2p_networking.html#version bytes [ 36 .. 44 ] . copy_from_slice ( & time . to_le_bytes ( ) ) ; // Checksum is specified at: // https://developer.bitcoin.org/reference/p2p_networking.html#message-headers let checksum = sha256d :: Checksum :: from ( & bytes [ HEADER_LEN .. ] ) ; bytes [ 20 .. 24 ] . copy_from_slice ( & checksum . 0 ) ; debug ! ( time old_len old_bytes len ( ) new_len bytes len ( ) old_bytes old_bytes [ 36 44 ] new_bytes bytes [ 36 44 ] ) ; bytes } ) ; rt . block_on ( async { let mut fr = FramedRead :: new ( Cursor :: new ( & v_bytes ) , Codec :: builder ( ) . finish ( ) ) ; fr . next ( ) . await . expect ( " " ) } ) }
Deserialize a `Version` message containing `time`, and return the result.
Deserialize a ` Version ` message containing ` time ` and return the result .
time
i64