Skip to content
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

refactor: remove CTxMemPool::queryHashes() #29260

Merged
merged 1 commit into from
Jan 22, 2024

Conversation

stickies-v
Copy link
Contributor

CTxMemPool::queryHashes() is only used in MempoolToJSON(), where it can just as easily be replaced with the more general CTxMemPool::entryAll(). No behaviour change, just cleans up the code.

@DrahtBot
Copy link
Contributor

DrahtBot commented Jan 17, 2024

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage

For detailed information about the code coverage, see the test coverage report.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK dergoegge, TheCharlatan, glozow

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

src/test/fuzz/tx_pool.cpp Show resolved Hide resolved
Comment on lines 359 to 363
LOCK(pool.cs);
pool.queryHashes(vtxid);
for (const CTxMemPoolEntry& e : pool.entryAll()) {
a.push_back(e.GetTx().GetHash().ToString());
}
mempool_sequence = pool.GetSequence();
Copy link
Member

Choose a reason for hiding this comment

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

Would be cool if we could use infoAll since that doesn't require the lock externally but we need the sequence to be in sync so we can't, oh well...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

entryAll returning just refs has less overhead than infoAll so I think regardless this is a preferred approach? (even if it's not a huge difference)

Copy link
Member

Choose a reason for hiding this comment

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

That overhead is tiny if any, I'd think. You can benchmark MempoolToJSON and it'd bet it won't even show up. But anyway we can't use it due to the sequence sync requirement.

Actually, maybe it's worth considering removing entryAll too? it's only used in two places and we can work around the sync issue somehow, but not in this PR...

@stickies-v
Copy link
Contributor Author

Force pushed to re-instate the fuzz test, addressing #29260 (comment)

Its only usage can easily be replaced with CTxMemPool::entryAll()
Copy link
Member

@dergoegge dergoegge left a comment

Choose a reason for hiding this comment

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

Code review ACK 282b12d

Copy link
Contributor

@TheCharlatan TheCharlatan left a comment

Choose a reason for hiding this comment

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

ACK 282b12d

@DrahtBot DrahtBot requested review from TheCharlatan and removed request for TheCharlatan January 19, 2024 13:08
Copy link
Member

@glozow glozow left a comment

Choose a reason for hiding this comment

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

ACK 282b12d. Looks like there's no conflicts.

@glozow glozow merged commit 651fb03 into bitcoin:master Jan 22, 2024
16 checks passed
@stickies-v stickies-v deleted the 2024-01/remove-queryhashes branch January 22, 2024 10:08
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.

None yet

5 participants