You can use
val cause = Txn.OptimisticFailureCause(category, trigger)
NestingLevel.root.requestRollback will doom the outermost transaction (and the inner ones), but does not throw the exception that causes control transfer. That will occur on the next STM access; here I trigger it immediately by calling Txn.rollback (the cause of the second rollback request will be discarded). Category and trigger can be whatever you like.