refactor: Move functions to BlockManager methods
Summary:
This is a commit in preparation for the next few commits. The functions
are moved to methods to avoid their re-declaration for the purpose of
passing in BlockManager options.
The functions that were now moved into the BlockManager should no longer
use the params as an argument, but instead use the member variable.
In the moved ReadBlockFromDisk and UndoReadFromDisk, change
the function signature to accept a reference to a CBlockIndex instead of
a raw pointer. The pointer is expected to be non-null, so reflect that
in the type.
To allow for the move of functions to BlockManager methods all call
sites require an instantiated BlockManager, or a callback to one.
This is a partial backport of core#27125 and core#25016
https://github.com/bitcoin/bitcoin/pull/27125/commits/f0bb1021f0d60f5f19176e67a66fcf7c325f88d1
https://github.com/bitcoin/bitcoin/pull/25016/commits/ed12c0a49d3c64d170aca9e66ef32a57d7933eeb
https://github.com/bitcoin/bitcoin/pull/25016/commits/86ce844d3b287012f27c7b0bad6d11c9bdd3120e
Depends on D16183
Test Plan:
With Chronik and bitcoin-chainstate:
ninja all check-all
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Subscribers: Fabien
Differential Revision: https://reviews.bitcoinabc.org/D16184