style: Modernize range-based loops over m_block_index
Summary:
This concludes backport of core#24050
https://github.com/bitcoin/bitcoin/pull/24050/commits/c05cf7aa1e1c15089753897a10c14762027d4b99
Depends on D12993
Test Plan: ninja all check-all
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Subscribers: Fabien
Differential Revision: https://reviews.bitcoinabc.org/D12994