Is there any way to receive a notification of a dropped transaction (not just confirmed/unconfirmed for event syncs)? I’m trying to set up a webhook to clean up any “unconfirmed” events in the DB that are leftover from dropped transactions.
Can you give an example of which type of event transactions you are looking into.
I believe there should be a column that says the transaction is not successful. If that is true in you case, you could use a beforeSave trigger to record the failed transactions in a different table.
@johnversus The only column I see is “confirmed”. The scenario would be where a transaction is put into the DB with a
confirmed: false status and is later dropped from the mempool. My understanding is the record in the DB would be there indefinitely with the
confirmed: false status - is that correct? I know this is likely an edge case but want to make sure I cover all my bases.
The transaction row which has a
confirmed: false column will stay as it is and a new row will be added to the table when the same tx hash is confirmed.
If this is true in your case, then while querying the database you need to filter out confirmed columns with true values.
@johnversus If the transaction was dropped and resubmitted it would have a new tx hash though. How would I be able to tell the original one with the
confirmed: false status was dropped?
I haven’t experienced such transactions before, to verify, but I believe there should be some similarity between the two rows.
there could be multiple rows in that case, one from the original event and one from the new event (they can have the same transaction hash, as it can happen in case of reorgs)
Thanks @cryptokid – is there any way to set up a webhook notification for a dropped transaction or any way to distinguish these events?
shouldn’t you care only about confirmed events?
you can connect directly to db, run a job to iterate over events ever x minutes, use beforeSave/afterSave to set a flag to know when a transaction was confirmed and make a request to your domain
there isn’t a direct way to do that from what I know, you have to write some code