The server stores its transaction-related data in thd->transaction. This structure has two members of type THD_TRANS. These members correspond to the statement and normal transactions respectively:
thd->transaction.stmt contains a list of engines that are participating in the given statement
thd->transaction.all contains a list of engines that have participated in any of the statement transactions started within the context of the normal transaction. Each element of the list contains a pointer to the storage engine, engine-specific transactional data, and engine-specific transaction flags.
In autocommit mode, thd->transaction.all is empty. In that case, data of thd->transaction.stmt is used to commit/roll back the normal transaction.
The list of registered engines has a few important properties:
No engine is registered in the list twice.
Engines are present in the list in reverse temporal order -- new participants are always added to the beginning of the list.