p2p: Release m_peer_mutex early in InitiateTxBroadcastToAll #35297

pull maflcko wants to merge 1 commits into bitcoin:master from maflcko:2605-p2p-mutex-early changing 2 files +18 −8
  1. maflcko commented at 9:40 AM on May 15, 2026: member

    The InitiateTxBroadcastToAll method holds the m_peer_mutex while updating the bloom filters for all peers. This is perfectly fine, because updating the bloom filters is fast. Though, from a style-perspective, the lock does not need to be held for the whole function. Also, holding the lock longer, may confuse Tsan into a lock-order inversion false-positive (ref: #19303 (comment)).

    So "fix" both issues in this style-refactor.

  2. p2p: Release m_peer_mutex early in InitiateTxBroadcastToAll fa2afba28b
  3. DrahtBot added the label P2P on May 15, 2026
  4. DrahtBot commented at 9:40 AM on May 15, 2026: 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/35297.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK xyzconstant

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #34628 (p2p: Replace per-peer transaction rate-limiting with global rate limits by ajtowns)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  5. maflcko marked this as a draft on May 15, 2026
  6. maflcko marked this as ready for review on May 15, 2026
  7. xyzconstant commented at 5:24 AM on May 19, 2026: none

    Code review ACK fa2afba28b5776a710386a3bacd5cb308149d671

    While reviewing #34628 noticed this minor issue with m_peer_mutex being held for too long. The refactor looks clean to me.


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: 2026-05-19 06:51 UTC