refactor: Avoid passing params where not needed #25168

pull MarcoFalke wants to merge 5 commits into bitcoin:master from MarcoFalke:2205-remove-bloat-🏮 changing 21 files +66 −92
  1. MarcoFalke commented at 4:51 PM on May 18, 2022: member

    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.
  2. Do not pass time getter to Chainstate helpers fa4ee53dca
  3. Do not pass Consensus::Params& to Chainstate helpers faf012b438
  4. Do not pass CChainParams& to BlockAssembler constructor fafe5c0ca2
  5. Do not pass CChainParams& to PeerManager::make fa30234be8
  6. Do not call global Params() when chainman is in scope fa1b76aeb0
  7. DrahtBot added the label Refactoring on May 18, 2022
  8. vincenzopalazzo approved
  9. fanquake commented at 8:58 AM on May 19, 2022: member

    Concept ACK

  10. DrahtBot commented at 3:16 PM on May 19, 2022: member

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

    • #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.

  11. promag commented at 11:01 AM on May 20, 2022: member

    Code review ACK fa1b76aeb064b315a3767a8f59836ca18aeb117e.

  12. MarcoFalke merged this on May 20, 2022
  13. MarcoFalke closed this on May 20, 2022

  14. MarcoFalke deleted the branch on May 20, 2022
  15. dongcarl commented at 10:38 PM on May 25, 2022: member

    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 :astonished: (no promises tho)

  16. sidhujag referenced this in commit 3bb5318bd1 on May 28, 2022
  17. DrahtBot locked this on May 25, 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-04-17 06:13 UTC

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