Add and use CBlockIndexHeightOnlyComparator
Summary:
...also use std::sort for clarity
Add also a simple unit test for coverage.
This is a partial backport of core#24515
https://github.com/bitcoin/bitcoin/pull/24515/commits/28ba0313eac37e4a900b7e97af7169ce999c4024
Depends on D13022
Test Plan: ninja all check-all
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Subscribers: Fabien
Differential Revision: https://reviews.bitcoinabc.org/D13023