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); } }
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); } }