Overall PR: #20158 (tree-wide: De-globalize ChainstateManager)
Based on:
- #21270 | [Bundle 4/n] Prune g_chainman usage in validation-adjacent modules
- #21525 | [Bundle 4.5/n] Followup fixups to bundle 4
Note to reviewers:
- This bundle may apparently introduce usage of
g_chainman
or::Chain(state|)Active()
globals, but these are resolved later on in the overall PR. Commits of overall PR - There may be seemingly obvious local references to
ChainstateManager
or other validation objects which are not being used in callers of the current function in question, this is done intentionally to keep each commit centered around one function/method to ease review and to make the overall change systematic. We don’t assume anything about our callers. Rest assured that once we are considering that particular caller in later commits, we will use the obvious local references. Commits of overall PR - When changing a function/method that has many callers (e.g.
LookupBlockIndex
with 55 callers), it is sometimes easier (and less error-prone) to use a scripted-diff. When doing so, there will be 3 commits in sequence so that every commit compiles like so:- Add
new_function
, makeold_function
a wrapper ofnew_function
, divert all calls toold_function
tonew_function
in the local module only - Scripted-diff to divert all calls to
old_function
tonew_function
in the rest of the codebase - Remove
old_function
- Add