refactor, consensus: remove calls to global `Params()` in validation layer #23448

pull lsilva01 wants to merge 1 commits into bitcoin:master from lsilva01:remove_call_params changing 2 files +9 −8
  1. lsilva01 commented at 9:36 PM on November 5, 2021: contributor

    This PR removes calls to global Params() in validation layer (except in the CChainState constructor).

    Motivation: Reducing the use of global variables makes code more predictable.

    Requires #23437 as it changes the visibility of CChainState::m_params to public.

  2. DrahtBot added the label P2P on Nov 5, 2021
  3. DrahtBot added the label RPC/REST/ZMQ on Nov 5, 2021
  4. DrahtBot added the label Utils/log/libs on Nov 5, 2021
  5. DrahtBot added the label Validation on Nov 5, 2021
  6. DrahtBot commented at 10:12 AM on November 6, 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:

    • #23581 (Move BlockManager to node/blockstorage by MarcoFalke)
    • #23174 (validation: have LoadBlockIndex account for snapshot use by jamesob)
    • #22674 (validation: mempool validation and submission for packages of 1 child + parents by glozow)

    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 Nov 6, 2021 from issue validation/refactor: refactoring for package submission by glozow
  8. DrahtBot cross-referenced this on Nov 6, 2021 from issue validation: have LoadBlockIndex account for snapshot use by jamesob
  9. DrahtBot cross-referenced this on Nov 6, 2021 from issue validation: mempool validation and submission for packages of 1 child + parents by glozow
  10. DrahtBot cross-referenced this on Nov 6, 2021 from issue net_processing: lock clean up by ajtowns
  11. DrahtBot cross-referenced this on Nov 6, 2021 from issue Erlay: bandwidth-efficient transaction relay protocol by naumenkogs
  12. DrahtBot cross-referenced this on Nov 8, 2021 from issue Remove CTxMemPool params from ATMP by lsilva01
  13. DrahtBot added the label Needs rebase on Nov 9, 2021
  14. stratospher commented at 6:03 AM on November 26, 2021: contributor

    Concept ACK.

    • aac6548
      • CChainParams m_params is made a public member of class CChainState.
      • chainstate.m_params is used instead of global Params() in AcceptToMemoryPool in validation.cpp. (with changes in fuzz/tx_pool.cpp done in PR 23465)
    • 20df92b
      • chainstate.m_params is used instead of global Params() in validation.cpp inside functions like ProcessNewPackage(), ProcessNewBlockHeaders(), LoadMempool() and PopulateAndValidateSnapshot().
      • The function signature of LoadBlockIndexDB() is changed to include the first argument as Consensus::Params and call site updated in order to avoid the global call to Params() within the function.

    I'm also curious to know if there's any added advantage in making m_params public (in comparison with using getters/setters)?

  15. Remove calls to global Params() in validation layer 8d44624839
  16. lsilva01 force-pushed on Dec 2, 2021
  17. DrahtBot removed the label Needs rebase on Dec 2, 2021
  18. DrahtBot cross-referenced this on Dec 2, 2021 from issue Move BlockManager to node/blockstorage by MarcoFalke
  19. DrahtBot added the label Needs rebase on Dec 15, 2021
  20. DrahtBot commented at 10:19 AM on December 15, 2021: contributor

    <!--cf906140f33d8803c4a75a2196329ecb-->

    🐙 This pull request conflicts with the target branch and needs rebase.

    <sub>Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a "draft".</sub>

  21. glozow removed the label RPC/REST/ZMQ on Jan 10, 2022
  22. glozow removed the label P2P on Jan 10, 2022
  23. glozow removed the label Utils/log/libs on Jan 10, 2022
  24. glozow added the label Refactoring on Jan 10, 2022
  25. fanquake commented at 10:54 AM on May 6, 2022: member

    @lsilva01 are you still interested in working on this?

  26. fanquake added the label Up for grabs on Jun 14, 2022
  27. fanquake closed this on Jun 14, 2022

  28. MarcoFalke removed the label Up for grabs on Jun 14, 2022
  29. MarcoFalke commented at 8:41 AM on June 14, 2022: member

    Pretty sure this is already done in master?

  30. bitcoin locked this on Jun 14, 2023

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