Transfer pepper mixture to a large, heavy-bottom pot over medium heat and stir in sugar, salt, and cayenne (if using) until combined. Bring to a boil, reduce heat to a simmer, and cook, stirring occasionally, until mixture is thickened and shiny, about 25 to 35 minutes.