-
Notifications
You must be signed in to change notification settings - Fork 21.5k
core: fix race conditions in txpool #23474
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
Conversation
core/tx_list.go
Outdated
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.
If the mu is only there to protect the reheap operation, perhaps rename it to reheapMu and do the lock/unlock inside of reheap instead?
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.
Renamed and moved
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.
Actually, now you can revert another change too: remove reheap again and have only Reheap.
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!
bb5e723 to
8906d9c
Compare
holiman
left a comment
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.
LGTM
| pool := NewTxPool(testTxPoolConfig, config, blockchain) | ||
|
|
||
| // wait for the pool to initialize | ||
| <-pool.initDoneCh |
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.
I don't understand this change. What's the point of waiting the loop function to start up 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.
Otherwise the resetState function race with the loop function
* core: fix race conditions in txpool * core: fixed races in the txpool * core: rebased on master * core: move reheap mutex * core: renamed mutex * core: revert Reheap changes
* core: fix race conditions in txpool * core: fixed races in the txpool * core: rebased on master * core: move reheap mutex * core: renamed mutex * core: revert Reheap changes
This PR fixes several race conditions in the txpool:
txList.SetBasefee(),txlist.Removed()andtxlist.Reheap()on who is allowed to reheap the listtxListon updating thetxlist.stalescountertxpool.loop()and reseting the txpool's blockchain between teststxpool.chain.gaslimitfrom within a test