Put in a saucepan on the fire, the margarine together with 150 gr of chocolate in pieces and mix frequently until they melt. Set aside to cool.
Fry and grind the walnut kernels.
Mix eggs with sugar, brown sugar, vanilla, rum and a pinch of salt for 5 minutes on high speed. With the mixer at low speed add the melted chocolate. We add flour and mix enough to homogenize the composition. Using a spatula, add the walnuts and the rest of the chocolate cut into small pieces.
Pour the composition into a tray with baking paper (20 x 30cm) and put in the preheated oven at 180ºC, for about 40 minutes or until it starts to come off easily from the edges.