Your post says "IT DOES NOT WORK so I removed some random code".
Show why "IT DOES NOT WORK"
NOT ask whether you broken something with your random change.
You just beg to be ignored under the GIGO principle.
The code you removed is correct. i.e. remove all uncommitted message adds
or TXOP="A" and TXID still in JMS_TRANSACTIONS.