This PR removes an unnecessary LOCK(mempool->cs) in ChainImpl::isInMempool(). The method calls CTxMemPool::exists(), which already locks mempool->cs internally. Because the mempool mutex is a RecursiveMutex, double-locking was safe but redundant. Dropping the outer lock matches patterns used elsewhere in ChainImpl (e.g. hasDescendantsInMempool() and GetTransactionAncestry() callers) where mempool read APIs are invoked without an additional lock and rely on the calleeās internal locking. isRBFOptIn() remains unchanged since IsRBFOptIn(tx, pool) explicitly requires the caller to hold pool.cs as indicated by its thread-safety annotation.
interfaces: remove redundant mempool lock in ChainImpl::isInMempool() #33946
pull Fibonacci747 wants to merge 1 commits into bitcoin:master from Fibonacci747:fix/redundant-mempool-lock-isInMempool changing 1 files +0 −1-
Fibonacci747 commented at 7:24 PM on November 25, 2025: contributor
-
fix: remove redundant mempool lock in ChainImpl::isInMempool() 2909655fba
-
DrahtBot commented at 7:24 PM on November 25, 2025: contributor
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--006a51241073e994b41acfe9ec718e94-->
Code Coverage & Benchmarks
For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/33946.
<!--021abf342d371248e50ceaed478a90ca-->
Reviews
See the guideline for information on the review process.
Type Reviewers ACK stickies-v, maflcko, instagibbs If your review is incorrectly listed, please copy-paste <code><!--meta-tag:bot-skip--></code> into the comment that the bot should ignore.
<!--5faf32d7da4f0f540f40219e4f7537a3-->
- stickies-v approved
-
stickies-v commented at 11:43 AM on November 26, 2025: contributor
ACK 2909655fba91a7cc59c484fc74afafdf7ccc0cfa
- fanquake renamed this:
fix: remove redundant mempool lock in ChainImpl::isInMempool()
interfaces: remove redundant mempool lock in ChainImpl::isInMempool()
on Nov 26, 2025 - DrahtBot added the label interfaces on Nov 26, 2025
-
maflcko commented at 11:52 AM on November 26, 2025: member
lgtm ACK 2909655fba91a7cc59c484fc74afafdf7ccc0cfa
-
instagibbs commented at 1:49 PM on November 26, 2025: member
utACK 2909655fba91a7cc59c484fc74afafdf7ccc0cfa
- fanquake merged this on Nov 26, 2025
- fanquake closed this on Nov 26, 2025
Contributors
Labels