-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
polygon/sync: fix parent td missing when forking at the tip #11867
Conversation
polygon/sync/sync.go
Outdated
newHeaders[i] = block.HeaderNoCopy() | ||
headerChain := make([]*types.Header, len(blockChain)) | ||
for i, block := range blockChain { | ||
block.Hash() |
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.
Why is block.Hash()
called here?
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.
good catch, I accidentally left it over after debugging
polygon/sync/sync.go
Outdated
if err := s.store.InsertBlocks(ctx, newBlocks); err != nil { | ||
return err | ||
} | ||
// len(blockChain) is always <= len(newConnectedHeaders) |
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.
Isn't it the other way around?
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.
yes, good catch, corrected
fixes #11818
issue was:
InsertBlocks
for the blocks we've just connected and also tocommitExecution
(callUpdateForkChoice
)fix is:
canonicalChainBuilder.Connect
to return the newly connected headers to the tree