Excellent reference with David.
We also have Abraham, who after being declared righteous......committed adultery!
Moses murdered an Egyptian.
Solomon did all kinds of things.
Yet none of these are ever considered to have lost their eternal reward.
We can take comfort that God loves us so much, He gave us His only begotten Son so that whosoever believes in Him should not perish, but have everlasting life.
For as high as the heavens are above the earth, so great is his steadfast love toward those who fear him; as far as the east is from the west, so far does he remove our transgressions from us. As a father shows compassion to his children, so the Lord shows compassion to those who fear him. For he knows our frame; he remembers that we are dust.