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.
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-
jimpo commented at 9:02 PM on May 22, 2018: contributor
-
4b71a9be68
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.
-
0bf758ba6c
rpc: Refactor getchaintips RPC to remove mapBlockIndex.
Moves the actual logic into a validation function.
-
init: Remove direct mapBlockIndex access from init. 7d8a627e77
-
validation: Stop exposing mapBlockIndex in header file. e09a90fcd7
-
15f439abdd
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.
-
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:
-- 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
-
jimpo commented at 9:10 PM on May 22, 2018: contributor
@TheBlueMatt Oops, you're right.
- jimpo closed this on May 22, 2018
- jimpo deleted the branch on May 22, 2018
-
jimpo commented at 9:37 PM on May 22, 2018: contributor
@TheBlueMatt Commit 4b71a9be686ac3b5deb48a0e12e3e4e2d1322624 removes the
mapBlockIndexusage in wallet_tests, which you may want to bring over for completeness. - MarcoFalke locked this on Sep 8, 2021