test: Fixup docs for NodeClockContext and SteadyClockContext
What changed, and why it matters
This commit only updates comments and an error message in test-related code. It does not change any program logic, so it cannot affect live Bitcoin Core behavior or introduce a security issue.
No security action needed; this is a routine documentation/test-message cleanup.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch is a documentation-only fixup. It rewords the Doxygen comment for NodeClock and MockableSteadyClock in src/util/time.h and updates the stderr message in src/test/fuzz/util/check_globals.cpp to mention NodeClockContext and SteadyClockContext alongside SetMockTime(). No executable code is modified.
Changed components
src/util/time.h (comments only)src/test/fuzz/util/check_globals.cpp (diagnostic message only)Inspect captured patch +9 / −7
diff --git a/src/test/fuzz/util/check_globals.cpp b/src/test/fuzz/util/check_globals.cpp
index f91a965a..ca311153 100644
--- a/src/test/fuzz/util/check_globals.cpp
+++ b/src/test/fuzz/util/check_globals.cpp
@@ -42,8 +42,10 @@ struct CheckGlobalsImpl {
std::cerr << "\n\n"
"The current fuzz target accessed system time.\n\n"
- "This is acceptable, but requires the fuzz target to call \n"
- "SetMockTime() at the beginning of processing the fuzz input.\n\n"
+ "This is acceptable, but requires the fuzz target to use \n"
+ "a NodeClockContext, SteadyClockContext or call \n"
+ "SetMockTime() at the \n" "beginning of processing the \n"
+ "fuzz input.\n\n"
"Without setting mock time, time-dependent behavior can lead \n"
"to non-reproducible bugs or inefficient fuzzing.\n\n"
diff --git a/src/util/time.h b/src/util/time.h
index 59abc4d5..967ea780 100644
--- a/src/util/time.h
+++ b/src/util/time.h
@@ -14,7 +14,8 @@
using namespace std::chrono_literals;
-/** Mockable clock in the context of tests, otherwise the system clock */
+/// Version of the system clock that is mockable in the context of tests (via
+/// NodeClockContext or ::SetMockTime), otherwise the system clock.
struct NodeClock : public std::chrono::system_clock {
using time_point = std::chrono::time_point<NodeClock>;
/** Return current system time or mocked time, if set */
@@ -31,10 +32,9 @@ using SteadyMicroseconds = std::chrono::time_point<std::chrono::steady_clock, st
using SystemClock = std::chrono::system_clock;
-/**
- * Version of SteadyClock that is mockable in the context of tests (set the
- * current value with SetMockTime), otherwise the system steady clock.
- */
+/// Version of SteadyClock that is mockable in the context of tests (via
+/// SteadyClockContext, or Self::SetMockTime), otherwise the system steady
+/// clock.
struct MockableSteadyClock : public std::chrono::steady_clock {
using time_point = std::chrono::time_point<MockableSteadyClock>;
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.