This question might be a duplicate of OP deletes code after question is solved / answered, what to do in these cases? [duplicate], but I am not sure.
There is one significant difference between my situation and that of the referenced question; Frakcool did not have any investment in whether the question edit was rolled back or not.
In my case, I have the accepted answer on this question How to get summation with count larger than certain amount. This morning I received a down-vote and a comment saying that my answer was wrong.
When I checked the question, it had been edited to remove code and information relevant to the question, no new information was added. My course of action was to roll back the edit to the question and respond to the comment on my answer explaining what I did and why.
A user with 14k+ rep commented:
First of all, you should never rollback an edit made by an OP just to prove your point. Secondly, your answer does not adequately address the opening problem statement that was there all the time and neither does the text that the OP deleted but which you rolled back make your answer right. It is just plain wrong either way. As an established user on SO you should know and accept that your only viable course of action is to delete your answer; ...
And rolled-back my rollback.
Was it wrong for me (specifically, not any other user) to rollback that edit to a question (made by the OP) because I can be perceived as having something to gain from it? Or for any other reasons?
What would my correct course of action been?
can_delete = !(upvoted && accepted)
is what I think is right, but am not sure. I did a quick search on meta to see if I could answer my uncertainty myself, before posting the comment, but found a mix including one that sounded like if the answer is accepted but downvoted (negative score) it could still be deleted