Hi thanks for your question.
The lump next to your anus most probably could be a pile mass. The pain could be due to inflammation of the pile mass.
Defecation aggrevates the pain.
Spontanous regression of inflammation is possible due to which your pain has decreased,but for blood in your testis you need examination by a physician as it could be a seperate issue.It could be a haematoma( blood under skin or muslcle)
I would suggest you to get yourself examined by a physician to rule out testicular haematoma,which if present needs investigation and drainage
Hope this answers your question.