Example #1
0
        public void TryDeserialize_FailTest(FastStreamReader stream, string expErr)
        {
            GetBlocksPayload pl = new GetBlocksPayload();

            bool b = pl.TryDeserialize(stream, out string error);

            Assert.False(b);
            Assert.Equal(expErr, error);
        }
Example #2
0
        public void TryDeserializeTest()
        {
            GetBlocksPayload pl     = new GetBlocksPayload();
            FastStreamReader stream = new FastStreamReader(Helper.HexToBytes(PayloadHex));
            bool             b      = pl.TryDeserialize(stream, out string error);

            byte[] hd1 = Helper.HexToBytes(Header1);
            byte[] hd2 = Helper.HexToBytes(Header2);

            Assert.True(b, error);
            Assert.Null(error);
            Assert.Equal(Version, pl.Version);
            Assert.Equal(new byte[][] { hd1, hd2 }, pl.Hashes);
            Assert.Equal(new byte[32], pl.StopHash);
            Assert.Equal(PayloadType.GetBlocks, pl.PayloadType);
        }