People who don’t understand the Hebrew style of logic regard this psalm as wandering from one idea to another. They even imagine it might be several short bits thrown together, as if Hebrew scholars were no wiser than half-grown children. It’s easy to discount what one does not quite grasp.
The heading of the psalm mentions someone from the Tribe of Benjamin. Never mind God’s revelation, that tribe generally regarded David as a usurper. The background tension was never forgotten, so we could hardly be surprised David felt the sting of persecution from anyone of that tribe. However, we cannot identify who Cush might have been, or if it was a symbolic name.
David never forget that it was God who placed him on the throne, and that it was God who kept him there. In this case we sense the matter was a campaign of slander against David. It was a peculiar symbol of Hebrew honor to volunteer for examination when slandered, demanding the proof be brought forward. David thus requests that God investigate him thoroughly. Should he be found at fault, David was asking to be turned over to his worst enemies. Otherwise, let the false accusers face the punishment they hoped to bring down on David, something specifically required and promised under the Covenant of Moses.
David notes that God is the Divine Judge of all humanity, so it was no insult to submit to His examination. It wasn’t arrogance but David’s confidence and peace with God that made him eager to face God’s test. That his God is the definition of righteousness makes David comfortable with embracing whatever he might face. Whatever sin clung to David would be cleansed and his character made yet stronger to rule. Who could ask for anything better?
Meanwhile, he characterizes the wrath of God against sin as relentless. Thus, those who opposed God’s moral character would find themselves inevitably trapped by their own evil. Moral blindness is its own punishment. David is grateful beyond words for that purity of God’s moral character actively at work in Creation.