Page MenuHomePhabricator

Require WriteUndoDataForBlock() to hold mutex cs_main
ClosedPublic

Authored by PiRK on Jan 24 2023, 07:12.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC4d9bd4f787d1: 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