core/txpool: use reheap snapshot to avoid duplicate entries in heap#2095
core/txpool: use reheap snapshot to avoid duplicate entries in heap#2095
Conversation
Codecov Report❌ Patch coverage is
❌ Your patch status has failed because the patch coverage (82.14%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## develop #2095 +/- ##
===========================================
- Coverage 51.31% 51.29% -0.03%
===========================================
Files 878 878
Lines 152668 152680 +12
===========================================
- Hits 78349 78315 -34
- Misses 69232 69272 +40
- Partials 5087 5093 +6
... and 18 files with indirect coverage changes
🚀 New features to boost your workflow:
|
lucca30
left a comment
There was a problem hiding this comment.
The code looks pretty good while keeping the asynchronous nature and keeping it performant. Would be good for the future looking to this small probabilistic case we discussed on one of the trends and als a benchmark to measure the improvements related to keeping it async, it still looks good to me and approved.
|
@claude review this PR focusing on performance and security. Also, make sure no regression and new race condition is introduced. Refer to the PR comments (and the original PR mentioned in description) for more context if needed. |
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
|
@claude review this PR focusing on performance and security. Also, make sure no regression and new race condition is introduced. Refer to the PR comments (and the original PR mentioned in description) for more context if needed. |
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
|


Description
A different solution to the problem stated in #2087.
This PR tries to add a new counter which just keeps track of the number of times reheap is done. We use this info while adding transactions to figure out whether to actually add the transaction to the heap or avoid it (so that there are no duplicates). This also ensures the calls still happen inside a go routine to keep the global tx pool lock as free as possible for the miner so that the performance benefits are intact.
Changes
Breaking changes
Please complete this section if any breaking changes have been made, otherwise delete it
Nodes audience
In case this PR includes changes that must be applied only to a subset of nodes, please specify how you handled it (e.g. by adding a flag with a default value...)
Checklist
Cross repository changes
Testing
Manual tests
Please complete this section with the steps you performed if you ran manual tests for this functionality, otherwise delete it
Additional comments
Please post additional comments in this section if you have them, otherwise delete it