tests: Add Assertions in reverse_lock tests to exercise thread-safety annotations
What changed, and why it matters
This commit only adds two runtime assertions to an existing test file. It does not change any production code, network behavior, wallet logic, or consensus rules. The assertions verify that a helper called reverse_lock correctly releases and re-acquires a mutex during tests. There is no security vulnerability here.
No action needed. This is a benign test-only change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff adds AssertLockHeld(mutex) before entering a REVERSE_LOCK scope and AssertLockNotHeld(mutex) inside that scope in src/test/reverselock_tests.cpp. These are test-only diagnostics that exercise Clang thread-safety annotations and confirm the reverse_lock helper’s behavior. No functional code is modified.
Changed components
src/test/reverselock_tests.cppInspect captured patch +2 / −0
diff --git a/src/test/reverselock_tests.cpp b/src/test/reverselock_tests.cpp
index 64b3ddf2..6abf55c8 100644
--- a/src/test/reverselock_tests.cpp
+++ b/src/test/reverselock_tests.cpp
@@ -17,8 +17,10 @@ BOOST_AUTO_TEST_CASE(reverselock_basics)
WAIT_LOCK(mutex, lock);
BOOST_CHECK(lock.owns_lock());
+ AssertLockHeld(mutex);
{
REVERSE_LOCK(lock, mutex);
+ AssertLockNotHeld(mutex);
BOOST_CHECK(!lock.owns_lock());
}
BOOST_CHECK(lock.owns_lock());
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.