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
  1. Fibonacci747 commented at 7:24 pm on November 25, 2025: contributor
    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.
  2. fix: remove redundant mempool lock in ChainImpl::isInMempool() 2909655fba
  3. DrahtBot commented at 7:24 pm on November 25, 2025: contributor

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

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/33946.

    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 <!–meta-tag:bot-skip–> into the comment that the bot should ignore.

  4. stickies-v approved
  5. stickies-v commented at 11:43 am on November 26, 2025: contributor
    ACK 2909655fba91a7cc59c484fc74afafdf7ccc0cfa
  6. fanquake renamed this:
    fix: remove redundant mempool lock in ChainImpl::isInMempool()
    interfaces: remove redundant mempool lock in ChainImpl::isInMempool()
    on Nov 26, 2025
  7. DrahtBot added the label interfaces on Nov 26, 2025
  8. maflcko commented at 11:52 am on November 26, 2025: member
    lgtm ACK 2909655fba91a7cc59c484fc74afafdf7ccc0cfa
  9. instagibbs commented at 1:49 pm on November 26, 2025: member
    utACK 2909655fba91a7cc59c484fc74afafdf7ccc0cfa
  10. fanquake merged this on Nov 26, 2025
  11. fanquake closed this on Nov 26, 2025


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-12-01 21:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me