Add functions to construct locators without CChain
Summary:
This introduces an insignificant performance penalty, as it means locator
construction needs to use the skiplist-based CBlockIndex::GetAncestor()
function instead of the lookup-based CChain, but avoids the need for
callers to have access to a relevant CChain object.
This is a partial backport of core#25717
https://github.com/bitcoin/bitcoin/pull/25717/commits/ed470940cddbeb40425960d51cefeec4948febe4
Depends on D15124
Test Plan: ninja all check-all
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Subscribers: Fabien
Differential Revision: https://reviews.bitcoinabc.org/D15125