Honestly, you should consult your doctor about weighing your options. Pain management is critical, but pain is temporary and, well, you know the struggle of addiction so I won't elaborate on how that feels. Your doctor will likely still prescribe opiates for pain management, as it would be necessary, but he would likely keep a very close eye on the dosage and what not and ensure you are weaned off with little withdrawal potential.
The fact is, left untreated, pain itself is a cause for relapse as much as the prescription of painkillers is. If your doctor is aware of your recovery, he will take that into perspective and be better able to treat you.
Just remember throughout that you will have to remain strong. That is a big Part of it, and keep in mind how one month clean is when you started feeling better, compared to the three years you struggled with using. Post-surgery medicating is changed when an a recovering addict is the patient, but your post-op doctor is the best person to talk to you about this, and may have even dealt with it before.
I am a stimulant addict, with years clean and I have relapsed, so I do not know firsthand your exact struggle, but I did date a heroin addict for a long while and watched her through recovery, relapse and recovery again.
I hope this helps somewhat.