Energy conservation for the weak solutions to the ideal inhomogeneous magnetohydrodynamic equations in a bounded domain. (February 2022)