fix(core/txpool/legacypool): reset gauges on clear #33654#2219
fix(core/txpool/legacypool): reset gauges on clear #33654#2219AnilChinchawale merged 1 commit intoXinFinOrg:dev-upgradefrom
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
3cf2a72 to
344f794
Compare
There was a problem hiding this comment.
Pull request overview
This PR fixes txpool metrics consistency by ensuring all transaction-count gauges are reset when LegacyPool.Clear() wipes the pool’s internal state. This aligns observed metrics with the cleared in-memory pool contents (useful for tests and any non-production invocations of Clear).
Changes:
- Reset
txpool/pending,txpool/queued, andtxpool/slotsgauges to0duringLegacyPool.Clear(). - Keep existing account-count gauge resets (
txpool/pending/accounts,txpool/queued/accounts) alongside the new resets.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Reset gauges | ||
| pendingGauge.Update(0) | ||
| queuedGauge.Update(0) | ||
| slotsGauge.Update(0) |
There was a problem hiding this comment.
The new behavior of resetting pendingGauge/queuedGauge/slotsGauge in Clear isn’t covered by tests. Since metrics correctness is the purpose of this fix, consider adding a small unit test that sets these gauges to non-zero values, calls pool.Clear(), and asserts they are reset to 0 (alongside the existing pool state assertions).
Proposed changes
Ref: ethereum#33654
Types of changes
What types of changes does your code introduce to XDC network?
Put an
✅in the boxes that applyImpacted Components
Which parts of the codebase does this PR touch?
Put an
✅in the boxes that applyChecklist
Put an
✅in the boxes once you have confirmed below actions (or provide reasons on not doing so) that