Skip to content
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

Fix tracker errors after a block reorganization #247

Merged
merged 3 commits into from
Jun 20, 2023

Conversation

Nemanja0x
Copy link
Contributor

The problem is when reorganization occurs on chain, so the parent block does not exist any more. function handleReconcileImpl() should check if the obtained block is nil (parent == nil):
parent, err := t.provider.GetBlockByHash(block.ParentHash, false)

There are some additional places in blocktracker.go and tracker.go which should be handled also. They are introduces in this PR as well.

@vercel
Copy link

vercel bot commented Jun 12, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ethgo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 19, 2023 0:44am

tracker/tracker.go Show resolved Hide resolved
Copy link
Contributor

@ferranbt ferranbt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix the comment and it should be good.

@@ -882,3 +888,15 @@ func parseUint64orHex(str string) (uint64, error) {
}
return strconv.ParseUint(str, base, 64)
}

func getBlockByNumber(provider Provider, blockNumber uint64) (*ethgo.Block, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add this as a function of Tracker.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed: 4b3217e

@ferranbt ferranbt merged commit bcb1d27 into umbracle:main Jun 20, 2023
@Nemanja0x Nemanja0x deleted the Fix_trackers_after_reorg branch June 20, 2023 07:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants