index: Don't commit a best block before indexing it during sync
Summary:
Committing a block prior to indexing would leave the index database
in an inconsistent state until it is indexed, which could corrupt the
index in case of a unclean shutdown. Thus commit its predecessor.
Co-authored-by: Luke Dashjr <luke-jr+git@utopios.org>
This is a backport of core#25074
Test Plan: ninja all check-all
Reviewers: #bitcoin_abc, roqqit
Reviewed By: #bitcoin_abc, roqqit
Differential Revision: https://reviews.bitcoinabc.org/D17702