https://github.com/bitcoin/bitcoin/pull/30666/commits/f5149ddb9b7de3559943d7fda0f440e59413dfb5:
Without doing so, header-only chains building on a chain that
will be marked as invalid would still be eligible for m_best_header.
This improves both getblockchaininfo and getchaintips behavior.While this adds an iteration over the entire block index, it can only be
triggered by the user (invalidateblock) or by others at a cost (the
header needs to be accepted in the first place, so it needs valid PoW).
Co-authored-by: TheCharlatan <seb.kung@gmail.com>
https://github.com/bitcoin/bitcoin/pull/30666/commits/ccd98ea4c88fc1aa959e41e0686d8dff00a44209
https://github.com/bitcoin/bitcoin/pull/30666/commits/0bd53d913c1c2ffd2d0779f01bc51c81537b6992
test: add test for getchaintips behavior with invalid chains
This test would fail to mark the chain tip as "invalid" instead
of "headers-only" without the previous commit marking the headers
as BLOCK_FAILED_CHILD.
Now the unintuitive behavior revealed and documented in D1987 in abc_feature_parkedchain.py becomes the expected behavior.
This concludes backport of core#30666
Depends on D18000