Exemplo n.º 1
0
        public void Read()
        {
            foreach (var str in Strings)
            {
                byte[] full = ArrayHelpers.ConcatArrays(str.Item2, Encoding.ASCII.GetBytes(str.Item1));

                using (BinaryReader reader = new BinaryReader(new MemoryStream(full))) {
                    VarString v = VarString.Read(reader);
                    Assert.AreEqual(str.Item1, v.Value);
                }
            }
        }
Exemplo n.º 2
0
        public override void ReadPayload(BinaryReader reader)
        {
            Version           = reader.ReadInt32();
            AvailableServices = (Services)reader.ReadUInt64();

            Time = UnixTime.DateTimeFromUnixTime(reader.ReadInt64());

            Recipient = NetworkNode.FromBinaryReader(reader);
            Sender    = NetworkNode.FromBinaryReader(reader);

            Nonce       = reader.ReadUInt64();
            UserAgent   = VarString.Read(reader).Value;
            BlockHeight = reader.ReadInt32();

            Relay = (Version >= 70001) && reader.ReadBoolean();             // BIP 0037
        }