Based on the formula of this question, it is possible to estimate the difference of the Sun's gravitational potential energy now and after it becomes a white dwarf.
$$\Delta E = GM^2\left (\frac{1}{r_{wd}} - \frac{1}{r_{now}}\right)$$
Taking the final radius $r_{wd} = 0,008 r_{now}$, (based on data from Sirius B), $\Delta E = 6*10^{43}$J
Looking for data of total power of the Sun, I found $3,846 * 10^{26}$W, and its estimated life 5 billion years.
So, in a rough approximation if my arithmetic is right, the energy until the Sun becomes a white dwarf is $4,7 * 10^{43}$J.
It seems too close to be coincidence, so my question is: is it correct to assume that a star's emitted energy equals the work of the gravitational field in reducing its size?
Another related question: does the estimated data for the remaining lifetime use the energy potential equation ($\frac{GM^2}{r}$)? Or it is an independent calculation?