assumeutxo,p2p: Start downloading historical blocks from common ancestor
Summary:
Otherwise, if the background tip is not an ancestor of the snapshot, blocks in between that ancestor up to the height of the background tip will never be requested.
Test loadtxoutset in divergent chain with less work.
Also guard against a m_mempool nullptr dereference which can happen in this situation, as the assumeutxo background chain does not maintain a mempool.
Co-authored-by: Martin Zumsande <mzumsande@gmail.com>
Co-authored-by: Alfonso Roman Zubeldia <19962151+alfonsoromanz@users.noreply.github.com>
This is a backport of core#29996
Depends on D17962
Test Plan: ninja all check-all
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Differential Revision: https://reviews.bitcoinabc.org/D17966