txmempool: add thread safety annotations #22003

pull ajtowns wants to merge 1 commits into bitcoin:master from ajtowns:202105-mempoolguards changing 2 files +8 −7
  1. ajtowns commented at 2:34 PM on May 20, 2021: contributor

    Add missing thread safety guards to CTxMempool members.

  2. hebasto commented at 2:35 PM on May 20, 2021: member

    Concept ACK.

  3. ajtowns cross-referenced this on May 20, 2021 from issue net_processing: lock clean up by ajtowns
  4. in src/txmempool.h:482 in 05d319dc9e outdated
     478 | @@ -479,21 +479,21 @@ class CTxMemPool
     479 |  protected:
     480 |      const int m_check_ratio; //!< Value n means that 1 times in n we check.
     481 |      std::atomic<unsigned int> nTransactionsUpdated{0}; //!< Used by getblocktemplate to trigger CreateNewBlock() invocation
     482 | -    CBlockPolicyEstimator* minerPolicyEstimator;
     483 | +    CBlockPolicyEstimator* minerPolicyEstimator GUARDED_BY(cs);
    


    vasild commented at 3:22 PM on May 20, 2021:

    This is only ever modified by assigning it in the constructor, can be const like m_check_ratio.

        CBlockPolicyEstimator* const minerPolicyEstimator;
    

    ajtowns commented at 2:14 AM on May 21, 2021:

    And the object protects itself via its own mutex. Done.

  5. hebasto approved
  6. hebasto commented at 3:25 PM on May 20, 2021: member

    ACK 05d319dc9ed2a33f2a08a698dc6d8b74ff77229b, I have reviewed the code and it looks OK, I agree it can be merged.

  7. DrahtBot added the label Mempool on May 20, 2021
  8. practicalswift commented at 6:33 PM on May 20, 2021: contributor

    Concept ACK

    Thanks for making the thread-safety annotations more complete!

  9. txmempool: add thread safety annotations 793b268284
  10. ajtowns force-pushed on May 21, 2021
  11. DrahtBot commented at 4:05 AM on May 21, 2021: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #21618 (WIP: Reduce MinRelayFee slower when Mempool utilised and faster when needed. by rebroad)

    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.

  12. hebasto approved
  13. hebasto commented at 5:42 AM on May 21, 2021: member

    re-ACK 793b2682841b0bdd7eb93163e34728765cfe52b2, only suggested changes since my previous review.

  14. DrahtBot cross-referenced this on May 21, 2021 from issue WIP: Reduce MinRelayFee slower when Mempool utilised and faster when needed. by rebroad
  15. MarcoFalke commented at 6:27 AM on May 21, 2021: member

    cr ACK 793b2682841b0bdd7eb93163e34728765cfe52b2

  16. MarcoFalke merged this on May 21, 2021
  17. MarcoFalke closed this on May 21, 2021

  18. vasild commented at 8:06 AM on May 21, 2021: contributor

    ACK 793b2682841b0bdd7eb93163e34728765cfe52b2

  19. sidhujag referenced this in commit 6887f7bc36 on May 21, 2021
  20. ryanofsky cross-referenced this on May 25, 2021 from issue Add fee_est tool for debugging fee estimation code by ryanofsky
  21. Fabcien referenced this in commit e92930083c on Apr 6, 2022
  22. gwillen referenced this in commit b9027c994c on Jun 1, 2022
  23. bitcoin locked this on Aug 18, 2022

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:53 UTC