Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Avoid passing params where not needed #25168

Merged
merged 5 commits into from
May 20, 2022

Conversation

maflcko
Copy link
Member

@maflcko maflcko commented May 18, 2022

It seems confusing to pass chain params, consensus params, or a time function around when it is not needed.

Fix this by:

  • Inlining the passed time getter function. I don't see a use case why this should be mockable.
  • Using chainman.GetConsensus() or chainman.GetParams(), where possible.

Copy link

@vincenzopalazzo vincenzopalazzo left a comment

Choose a reason for hiding this comment

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

ACK fa1b76a

@fanquake
Copy link
Member

Concept ACK

@DrahtBot
Copy link
Contributor

DrahtBot commented May 19, 2022

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #25073 (test: Cleanup miner_tests by MarcoFalke)
  • #25064 ([kernel 2b/n] Add ChainstateManager::m_adjusted_time_callback by dongcarl)
  • #24474 (Additional thread safety annotations for CNode/Peer by ajtowns)
  • #24232 (assumeutxo: add init and completion logic by jamesob)
  • #23443 (p2p: Erlay support signaling by naumenkogs)
  • #21527 (net_processing: lock clean up by ajtowns)
  • #21006 (rpc: reduce LOCK(cs_min) scope in rest_block: ~5 times as many requests per second by martinus)
  • #18933 (rpc: Add submit option to generateblock 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.

@promag
Copy link
Contributor

promag commented May 20, 2022

Code review ACK fa1b76a.

@dongcarl
Copy link
Contributor

post-merge ACK. This synergizes well with some of the upcoming libbitcoinkernel changes. We might actually be able to remove all references to a global CChainParams 😲 (no promises tho)

sidhujag pushed a commit to syscoin/syscoin that referenced this pull request May 28, 2022
@bitcoin bitcoin locked and limited conversation to collaborators May 25, 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