It is obvious that the undo files (rev*.dat files) are stored to restore the blockchain to a previous version when a re-org takes place. What is not clear to me is what are the exact uses of the contents of these files.
I am basing my questions off of this answer explaining the contents of the undo files and this answer explaining thoroughly the structure of the chainstate database.
Firstly, why don't the CTxInUndo records contain any mention of the parent TXID of the outputs used? Won't this information be needed to insert these outputs back into the chainstate as UTXOs? How is the chainstate restored using only the information contained in these records?
Secondy, what about the outputs created by the transactions of this block? Since they should be removed from chainstate after a re-org, why are there no records for them in the undo files?
Lastly, why is the height in the CTxInUndo record stored as 2*height (+1 if it was a coinbase output)
and not just height
? Is the shift by a bit used to store if the transaction was coinbase or not?