refactor: move `update_*` structs from txmempool.h to .cpp file #23211

pull theStack wants to merge 2 commits into bitcoin:master from theStack:202110-refactor-various_mempool_cleanups changing 2 files +53 −53
  1. theStack commented at 1:50 AM on October 7, 2021: contributor

    These helpers are exclusively used in txmempool.cpp, hence they should also be moved there. The PR also contains a commit which fixes const-correctness for parents in CTxMemPool::UpdateAncestorsOf and declares them as reference to avoid a copy.

  2. refactor: use const reference for parents in `CTxMemPool::UpdateAncestorsOf` 9947ce6262
  3. refactor: move `update_*` structs from txmempool.h to .cpp file
    These helpers are exclusively used in txmempool.cpp, hence they
    should also be moved there.
    
    Can be reviewed with "--color-moved=dimmed-zebra".
    65aaf9495d
  4. fanquake added the label Refactoring on Oct 7, 2021
  5. practicalswift commented at 7:47 AM on October 7, 2021: contributor

    Concept ACK

  6. DrahtBot commented at 5:51 PM on October 7, 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:

    • #23418 (Fix signed integer overflow in prioritisetransaction RPC by MarcoFalke)

    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.

  7. DrahtBot cross-referenced this on Oct 8, 2021 from issue refactor: Nuke policy/fees->mempool circular dependencies by hebasto
  8. in src/txmempool.cpp:281 in 9947ce6262 outdated
     275 | @@ -276,7 +276,7 @@ bool CTxMemPool::CalculateMemPoolAncestors(const CTxMemPoolEntry &entry,
     276 |  
     277 |  void CTxMemPool::UpdateAncestorsOf(bool add, txiter it, setEntries &setAncestors)
     278 |  {
     279 | -    CTxMemPoolEntry::Parents parents = it->GetMemPoolParents();
     280 | +    const CTxMemPoolEntry::Parents& parents = it->GetMemPoolParentsConst();
     281 |      // add or remove this tx as a child of each parent
     282 |      for (const CTxMemPoolEntry& parent : parents) {
    


    promag commented at 7:53 PM on October 15, 2021:

    9947ce62626c05bd186ae8a4864aa382f673ec1a

    Note that parent can be non-const. Maybe GetMemPoolParentsConst should return std::set<const CTxMemPoolEntryRef, CompareIteratorByHash> instead.

  9. promag commented at 8:03 PM on October 15, 2021: member

    Code review ACK 65aaf9495d19ea3fb875228a7e14aab6c1f2986d. Verified move-only commit locally.

  10. DrahtBot cross-referenced this on Nov 3, 2021 from issue Fix signed integer overflow in prioritisetransaction RPC by MarcoFalke
  11. MarcoFalke merged this on Nov 3, 2021
  12. MarcoFalke closed this on Nov 3, 2021

  13. theStack deleted the branch on Nov 3, 2021
  14. sidhujag referenced this in commit 83ef64b35f on Nov 3, 2021
  15. glozow cross-referenced this on Nov 15, 2021 from issue cut the validation <-> txmempool circular dependency 2/2 by glozow
  16. Fabcien referenced this in commit 8b97d1b5d5 on Oct 19, 2022
  17. bitcoin locked this on Nov 3, 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-20 06:53 UTC