We propose an algorithm which produces a randomized strategy reaching optimal data propagation in wireless sensor networks (WSN).In [6] and [8], an energy balanced solution is sought using an approximation algorithm. Our algorithm improves by (a) when an energy-balanced solution does not exist, it still finds an optimal solution (whereas previous algorithms did not consider this case and provide no useful solution) (b) instead of being an approximation algorithm, it finds the exact solution in one pass. We also provide a rigorous proof of the optimality of our solution.