Psalm 26:3 (ESV)

3 For your steadfast love is before my eyes, and I walk in your faithfulness.

David was very aware of God’s grace and faithfulness. He was not being hypocritical when he confessed to walk in faithfulness. He knew that his righteousness did not come from himself, but was a work of God in him.