I would like to clarify the expected behaviour for unconfirmed and confirmed transactions in Moralis that are synced using the sync contract events.
If I understand correctly, as soon as the transaction is mined, it is written to the table with confirmed = false. After a while, once the transaction is confirmed, the confirmed is updated to true. For 99% of all transactions this will probably work this way, now I want to clarify 2 edge cases:
-
Original transaction is uncled and gets placed into another block
what happens here? Is a second entry written to the table which will be confirmed later, leaving me with a confirmed and unconfirmed entry? Or when the transaction is confirmed will the information (e.g., block timestmap, tx index, etc) be overwritten by the confirmed values and I will have one confirmed entry? -
Original (successful) transaction is uncled and confirmed transaction failed (for example I make a buy on uniswap, the buy goes through initially, tx gets uncled, another transaction is placed before mine making my transaction fail due to slippage)
Will I be left with an unconfirmed entry in the database (because with the failed transaction, no events will be emitted) or will the entry be deleted from the database?
I know that these are exceptionally rare edge cases but still, I feel like this is quite important to keep in mind and the documentation doesnโt go to deep into this topic