Skip to content

fix(rpc): avoid rebuilding mempool index per transaction in getrawmempool#10599

Open
syszery wants to merge 1 commit into
ZcashFoundation:mainfrom
syszery:fix/optimize-getrawmempool
Open

fix(rpc): avoid rebuilding mempool index per transaction in getrawmempool#10599
syszery wants to merge 1 commit into
ZcashFoundation:mainfrom
syszery:fix/optimize-getrawmempool

Conversation

@syszery
Copy link
Copy Markdown
Contributor

@syszery syszery commented May 19, 2026

Motivation

Closes #10587

Fix performance issue in getrawmempool by avoiding repeated reconstruction of the mempool index for each transaction.

Implements the optimization suggested in the issue.

Solution

Move construction of transactions_by_id to the RPC caller and pass it into from_verified_unmined_tx, as outlined in the issue.

Tests

Existing property tests were updated to reflect the changed function signature. All tests pass locally.

AI Disclosure

  • No AI tools were used in this PR
  • AI tools were used: ChatGPT was used to draft the PR description and polish text.

PR Checklist

  • The PR title follows conventional commits format: type(scope): description
  • The PR follows the contribution guidelines.
  • This change was discussed in an issue or with the team beforehand.
  • The solution is tested.
  • The documentation and changelogs are up to date.

Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@syszery
Copy link
Copy Markdown
Contributor Author

syszery commented May 23, 2026

As a side note, I think we can optimize this further by removing .cloned() on the dependencies() HashSet. Since we already have empty_set defined above, maybe we can use .unwrap_or(&empty_set).iter().map(...). I will test this later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

getrawmempool true rebuilds per-transaction HashMap on every iteration

2 participants