It can be due to holding in urination. You can cause an increase in interstitial fluid pressure, pushing fluid into capillaries, this expanding, causing damage to the blood vessels that supply the area. Many are too quick to say it’s a prostate issue, but not well versed in starling forces,
Net filtration pressure = (Pc - Pi) - (Nc - Ni)
Pc - capillary pressure - pushes fluid out of a capillary
Pi - interstitial fluid pressure - pushes fluid into a capillary
Nc - plasma colloid osmotic pressure - pulls fluid into capillary
Ni - interstitial fluid colloid osmotic pressure - pulls fluid out of a capillary.
If your onset of ED was sudden after with holding voiding (urination), i would assume the underlying eitiology would be damage to your blood vessels, rather than a prostate issue.
Don’t hold back urination.
I can't imagine you could injure yourself by holding it all night but who knows.
So you think this is more to a possible prostate problem than an injury I could have done to my penis.
It's never good to not urinate whenever you need to - this could be a symptom of prostate concerns - see a doctor :-)