-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rewrite confirmTransaction to handle re-orgs #3611
Comments
I'm writing a new |
That would be awesome! |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment. |
@benjamincburns just want to confirm you're not touching on this anymore? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment. |
Problem
#3608 discovered a bug where confirmTransaction doesn't properly handle a re-org. It is most likely occurring within this code block, because there is no concept of a start/previous block theres no ability to perform a check for inconsistencies between blocks.
Potential solution
We probably want to track a few different things:
block -1
, we must actually cache the received block)This way we can do a check such as (very naive):
currentBlockNumber - PrevioudBlockNumber == 1
to ensure that we're on the sequential chain. We may also want to double check that theincludedBlock
hasn't changed with the incomingreceipt
. Doing those checks could identify a reorg took place. To properly account for the number of confirmations the counter, found on line 334 should actually be computed by usingcurrentBlockNumber - PreviousBlockNumber
so it can reset if there is a re-org. I believe doing that alone, would probably solve this issue, but it might be interesting to see if we want to log a re-org.I found an stackoverflow that can be used as inspiration.
cc: @cgewecke
The text was updated successfully, but these errors were encountered: