Absorbtion hearts will appear if the player gets killed with channelling I and impaling V trident then instantly gets after respawning, this is during a thunderstorm. The amount of golden hearts depends on the damage inflicted to the player. The 3 golden hearts was achieved by using a sharpness V diamond sword.
Reconstruction video (see attachment) should summarise what's happening here
Update: I was messing around with this bug, and i discovered that you only need a one shot weapon to get the absorption hearts (see other attachment)