Now that #32467 is merged, the only remaining usage of our old CRITICAL_SECTION
macros (other than tests) is in getblocktemplate()
and it can safely be replaced with a REVERSE_LOCK
.
This PR makes that replacement, replaces the old CRITICAL_SECTION
macro usage in tests, then deletes the macros themselves.
While testing this a few weeks ago, I noticed that REVERSE_LOCK
does not currently work properly with our thread-safety annotations as after the REVERSE_LOCK
is acquired, clang still believes that the mutex is locked. #32465 fixes this problem. Without that fix, this PR would potentially allow a false-negative if code were added in the future to this chunk of getblocktemplate
which required cs_main
to be locked.
I added a test for the reverse lock here in the form of a compiler warning in reverselock_tests.cpp
to simulate that possibility. This PR will therefore cause a new warning (and should fail a warnings-as-errors ci check) until #32465 is merged and this is rebased on top of it.