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: member

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

    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 added the label Needs rebase on Nov 9, 2021
  8. 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)?

  9. Remove calls to global Params() in validation layer 8d44624839
  10. lsilva01 force-pushed on Dec 2, 2021
  11. DrahtBot removed the label Needs rebase on Dec 2, 2021
  12. DrahtBot added the label Needs rebase on Dec 15, 2021
  13. DrahtBot commented at 10:19 am on December 15, 2021: member

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

    Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a “draft”.

  14. glozow removed the label RPC/REST/ZMQ on Jan 10, 2022
  15. glozow removed the label P2P on Jan 10, 2022
  16. glozow removed the label Utils/log/libs on Jan 10, 2022
  17. glozow added the label Refactoring on Jan 10, 2022
  18. fanquake commented at 10:54 am on May 6, 2022: member
    @lsilva01 are you still interested in working on this?
  19. fanquake added the label Up for grabs on Jun 14, 2022
  20. fanquake closed this on Jun 14, 2022

  21. MarcoFalke removed the label Up for grabs on Jun 14, 2022
  22. MarcoFalke commented at 8:41 am on June 14, 2022: member
    Pretty sure this is already done in master?
  23. DrahtBot 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: 2024-11-22 09:12 UTC

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