Do not unlock cs_main in ABC unless we've actually made progress.
Summary:
Technically, some internal datastructures may be in an inconsistent
state if we do this, though there are no known bugs there. Still,
for future safety, its much better to only unlock cs_main if we've
made progress (not just tried a reorg which may make progress).
This is extracted from Core PR13023 : https://github.com/bitcoin/bitcoin/pull/13023/commits/ecc3c4a019e6db30e208b8554b1a3658dcb9a80a
Test Plan:
make check
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Differential Revision: https://reviews.bitcoinabc.org/D3435