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

core: properly reset the statedb on sethead #22247

Merged

Conversation

MariusVanDerWijden
Copy link
Member

This pr fixes an issue where local transactions that were included in the chain before a SetHead could not be replayed since the txpool still had the old statedb after the setHead and would reject them with nonce to low.
For a repro see the linked issue

resolves: #19346

Copy link
Contributor

@holiman holiman left a comment

Choose a reason for hiding this comment

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

Semantically, this totally LGTM, and it's correct.

However, it would be totally possible to rewrite this a bit, so that instead of updating the things inside of the nested clause, you reorder the clauses a bit so that this case can just fall through. That way we don't need to increase the code size, and you would also get that pool fork update fixed.

core/tx_pool.go Outdated Show resolved Hide resolved
Copy link
Contributor

@holiman holiman left a comment

Choose a reason for hiding this comment

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

LGTM, minor nitpick

Copy link
Contributor

@holiman holiman left a comment

Choose a reason for hiding this comment

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

LGTM

@antazoey
Copy link

I think part of this issue is unresolved:

#26154

gzliudan pushed a commit to gzliudan/XDPoSChain that referenced this pull request May 14, 2024
fixes an issue where local transactions that were included in the chain before a SetHead were rejected if resubmitted, since the txpool had not reset the state to the current (older) state.
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.

debug_setHead causes Clique to hang when period is 0
3 participants