All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger.
If a person doubts too much to an extent that his doubts reach the level of whispers, then he should repel these whispers and not take heed to them. So, if he doubts whether he prostrated once or twice, he should refrain from these whispers and consider that he had prostrated twice, and he should always do so until Allaah cures him.
As regards whoever doubts in his prayer while he is not afflicted with whispers, then he should consider the least and neglect the doubt. So, if he doubts whether he had prayed two Rak’ahs or three Rak’ahs, then he should consider that he had prayed two Rak’ahs only and refrain from the doubt and rely on what he is certain of.
On the other hand, if he doubts about the prostration of forgetfulness whether he had prostrated once or twice, then he should cast aside doubt and consider that he had prostrated once only, and he should prostrate the second prostration but he should not prostrate for forgetfulness again, as forgetfulness in the prostration for forgetfulness does not require another prostration for forgetfulness.
Therefore, what you did is correct as you considered the number of prostrations two and not one when you doubted about it, especially if you are afflicted with whispers as we have clarified.
Allaah Knows best.