Refactor: encapsulate mapBlockIndex within validation.cpp #13305

pull jimpo wants to merge 5 commits into bitcoin:master from jimpo:validation-globals changing 8 files +103 −59
  1. jimpo commented at 9:02 PM on May 22, 2018: contributor

    This is part of an effort to remove global variables and use more well-defined interfaces. Continued effort in this direction should make it easier to create a shared library for Bitcoin consensus rules.

  2. test: Refactor wallet test not to depend on mapBlockIndex.
    Instead of inserting directly into the underlying block index data
    structure, the test now uses the public ProcessNewBlockHeaders
    function.
    4b71a9be68
  3. rpc: Refactor getchaintips RPC to remove mapBlockIndex.
    Moves the actual logic into a validation function.
    0bf758ba6c
  4. init: Remove direct mapBlockIndex access from init. 7d8a627e77
  5. validation: Stop exposing mapBlockIndex in header file. e09a90fcd7
  6. Remove mapBlockIndex from code comments outside of validation.
    Now that mapBlockIndex is not publicly exposed by the validation unit,
    other modules should not have references to the internal variable name.
    15f439abdd
  7. TheBlueMatt commented at 9:04 PM on May 22, 2018: member

    Seems duplicative with #12802.

    On May 22, 2018 9:02:19 PM UTC, Jim Posen notifications@github.com wrote:

    This is part of an effort to remove global variables and use more well-defined interfaces. Continued effort in this direction should make it easier to create a shared library for Bitcoin consensus rules. You can view, comment on, or merge this pull request online at:

    #13305

    -- Commit Summary --

    • test: Refactor wallet test not to depend on mapBlockIndex.
    • rpc: Refactor getchaintips RPC to remove mapBlockIndex.
    • init: Remove direct mapBlockIndex access from init.
    • validation: Stop exposing mapBlockIndex in header file.
    • Remove mapBlockIndex from code comments outside of validation.

    -- File Changes --

    M src/init.cpp (8) M src/interfaces/wallet.cpp (3) M src/net_processing.cpp (4) M src/rpc/blockchain.cpp (32) M src/txdb.cpp (1) M src/validation.cpp (50) M src/validation.h (18) M src/wallet/test/wallet_tests.cpp (46)

    -- Patch Links --

    https://github.com/bitcoin/bitcoin/pull/13305.patch https://github.com/bitcoin/bitcoin/pull/13305.diff

    -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/bitcoin/bitcoin/pull/13305

  8. jimpo commented at 9:10 PM on May 22, 2018: contributor

    @TheBlueMatt Oops, you're right.

  9. jimpo closed this on May 22, 2018

  10. jimpo deleted the branch on May 22, 2018
  11. jimpo commented at 9:37 PM on May 22, 2018: contributor

    @TheBlueMatt Commit 4b71a9be686ac3b5deb48a0e12e3e4e2d1322624 removes the mapBlockIndex usage in wallet_tests, which you may want to bring over for completeness.

  12. MarcoFalke locked this on Sep 8, 2021
Contributors

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-21 12:15 UTC

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