HomePhabricator

Require WriteUndoDataForBlock() to hold mutex cs_main

Description

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

Details

Provenance
Jon Atack <jon@atack.com>Authored on Oct 21 2021, 14:56
PiRKCommitted on Jan 24 2023, 09:20
PiRKPushed on Jan 24 2023, 09:21
Reviewer
Restricted Project
Differential Revision
D13032: Require WriteUndoDataForBlock() to hold mutex cs_main
Parents
rABC1e299c97637c: Require CBlockIndex::GetBlockPos() to hold mutex cs_main
Branches
Unknown
Tags
Unknown