-
Notifications
You must be signed in to change notification settings - Fork 134
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this 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.
tracker/tracker.go
Outdated
@@ -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) { |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed: 4b3217e
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 isnil
(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.