Skip to content

Conversation

lsilva01
Copy link
Contributor

@lsilva01 lsilva01 commented Nov 5, 2021

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.

@DrahtBot
Copy link
Contributor

DrahtBot commented Nov 6, 2021

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.

Copy link
Contributor

@stratospher stratospher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)?

@DrahtBot
Copy link
Contributor

🐙 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".

@fanquake
Copy link
Member

fanquake commented May 6, 2022

@lsilva01 are you still interested in working on this?

@maflcko
Copy link
Member

maflcko commented Jun 14, 2022

Pretty sure this is already done in master?

@bitcoin bitcoin locked and limited conversation to collaborators Jun 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants