Require WriteUndoDataForBlock() to hold mutex cs_main
Summary:
Mutex cs_main is already held by the caller of WriteUndoDataForBlock().
This change is needed to require CBlockIndex::GetUndoPos() to hold
cs_main and CBlockIndex::nStatus to be guarded by cs_main in the
following commits without adding 2 unnecessary cs_main locks to
WriteUndoDataForBlock().
This is a partial backport of core#22932
https://github.com/bitcoin/bitcoin/pull/22932/commits/2e557ced2830fc54476e598d52225f1679205e7d
Depends on D13031
Test Plan:
With clang and DEBUG:
ninja all check-all
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Differential Revision: https://reviews.bitcoinabc.org/D13032