Skip to content

fix(core/txpool/legacypool): clarify and fix non-executable tx heartbeat #33704#2220

Merged
AnilChinchawale merged 1 commit intoXinFinOrg:dev-upgradefrom
gzliudan:fix-legacypool-queue-bump
Mar 24, 2026
Merged

fix(core/txpool/legacypool): clarify and fix non-executable tx heartbeat #33704#2220
AnilChinchawale merged 1 commit intoXinFinOrg:dev-upgradefrom
gzliudan:fix-legacypool-queue-bump

Conversation

@gzliudan
Copy link
Collaborator

Proposed changes

Ref: ethereum#33704

Types of changes

What types of changes does your code introduce to XDC network?
Put an in the boxes that apply

  • build: Changes that affect the build system or external dependencies
  • ci: Changes to CI configuration files and scripts
  • chore: Changes that don't change source code or tests
  • docs: Documentation only changes
  • feat: A new feature
  • fix: A bug fix
  • perf: A code change that improves performance
  • refactor: A code change that neither fixes a bug nor adds a feature
  • revert: Revert something
  • style: Changes that do not affect the meaning of the code
  • test: Adding missing tests or correcting existing tests

Impacted Components

Which parts of the codebase does this PR touch?
Put an in the boxes that apply

  • Consensus
  • Account
  • Network
  • Geth
  • Smart Contract
  • External components
  • Not sure (Please specify below)

Checklist

Put an in the boxes once you have confirmed below actions (or provide reasons on not doing so) that

  • This PR has sufficient test coverage (unit/integration test) OR I have provided reason in the PR description for not having test coverage
  • Tested on a private network from the genesis block and monitored the chain operating correctly for multiple epochs.
  • Provide an end-to-end test plan in the PR description on how to manually test it on the devnet/testnet.
  • Tested the backwards compatibility.
  • Tested with XDC nodes running this version co-exist with those running the previous version.
  • Relevant documentation has been updated as part of this PR
  • N/A

Copilot AI review requested due to automatic review settings March 20, 2026 11:34
@coderabbitai
Copy link

coderabbitai bot commented Mar 20, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6de1f3b1-6e8d-4f4c-a6b7-162470a6d9dd

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gzliudan gzliudan changed the base branch from main to dev-upgrade March 20, 2026 11:34
@gzliudan gzliudan requested review from AnilChinchawale, anunay-xin, benjamin202410, liam-lai and wanwiset25 and removed request for Copilot March 20, 2026 11:35
Copilot AI review requested due to automatic review settings March 24, 2026 11:23
@gzliudan gzliudan force-pushed the fix-legacypool-queue-bump branch from 163b706 to a075967 Compare March 24, 2026 11:23
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adjusts how the legacy txpool’s non-executable (queued) transaction “heartbeat” is tracked, preventing heartbeats from being created/updated for accounts that don’t currently have queued transactions and clarifying related semantics in comments.

Changes:

  • Make queue.bump a no-op for unknown addresses (only updates heartbeat for accounts already tracked in beats).
  • Clarify Config.Lifetime meaning as “staleness” time for queued accounts (not per-tx lifetime).
  • Update/clarify comments around when queued heartbeats are bumped during replacement/promotion.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
core/txpool/legacypool/queue.go Changes bump to only update existing heartbeats, avoiding seeding beats for accounts without queued txs.
core/txpool/legacypool/legacypool.go Comment clarifications for Lifetime and for heartbeat bumping during tx replacement/promotion.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +92 to +97
// bump updates the heartbeat for the given account address.
// If the address is unknown, the call is a no-op.
func (q *queue) bump(addr common.Address) {
q.beats[addr] = time.Now()
if _, ok := q.beats[addr]; ok {
q.beats[addr] = time.Now()
}
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

Consider adding a regression test for the fixed heartbeat behavior: when queue.bump(addr) is called for an address with no queued txs, it should not pre-create a heartbeat that later prevents queue.add from initializing a fresh heartbeat. Without a test, it’s easy to reintroduce the bug where newly-queued txs can be treated as immediately stale because an old beats[addr] already exists.

Copilot uses AI. Check for mistakes.
@gzliudan gzliudan force-pushed the fix-legacypool-queue-bump branch from a075967 to e6e7773 Compare March 24, 2026 14:28
@AnilChinchawale AnilChinchawale merged commit 9f5d8ea into XinFinOrg:dev-upgrade Mar 24, 2026
13 checks passed
@gzliudan gzliudan deleted the fix-legacypool-queue-bump branch March 24, 2026 15:04
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.

6 participants