Beispiel #1
0
        public override void Encode(BinaryWriter writer)
        {
            writer.WriteVariableLengthString(RejectedCommand);
            writer.Write((byte)Code);
            writer.WriteVariableLengthString(Reason);

            var msgCommand = MsgCommand.Find(RejectedCommand);

            if (msgCommand == MsgCommand.Block || msgCommand == MsgCommand.Tx)
            {
                writer.Write(Hash);
            }
        }
Beispiel #2
0
        public override void Decode(BinaryReader reader)
        {
            RejectedCommand = reader.ReadVariableLengthString(MaxMessagePayload);
            Code            = (RejectCode)reader.ReadByte();
            Reason          = reader.ReadVariableLengthString(MaxMessagePayload);

            var msgCommand = MsgCommand.Find(RejectedCommand);

            if (msgCommand == MsgCommand.Block || msgCommand == MsgCommand.Tx)
            {
                Hash = reader.ReadBytes(32);
            }
        }