Instead of having CBlockIndex's live on the heap, which requires manual
memory management, have them be owned by m_block_index. This means that
they will live and die with BlockManager.
A change to BlockManager::LookupBlockIndex:
- Previously, it was a const member function returning a non-const CBlockIndex*
- Now, there's are const and non-const versions of
BlockManager::LookupBlockIndex returning a CBlockIndex with the same
const-ness as the member function:
(e.g. const CBlockIndex* LookupBlockIndex(...) const)
See next commit for some weirdness that this eliminates.
The range based for-loops are modernize (using auto + destructuring) in
a future commit.
https://github.com/bitcoin/bitcoin/pull/24050/commits/bec86ae32683ac56b4e6ba9c9b7d21cfbdf4ac03
https://github.com/bitcoin/bitcoin/pull/24050/commits/c2a1655799c5d5dab9b14bd2a6b2d2296efd6964