test: Drop ++ from NodeClockContext default constructor
What changed, and why it matters
This is a tiny test-only code cleanup. It removes a +1 second adjustment in a test helper constructor that was meant to prevent mock clock timestamps from looking like they moved backward due to rounding. The change only affects Bitcoin Core's internal unit tests and has no impact on the live Bitcoin network or wallet software.
No action required. This is a benign test refactor with no security relevance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit modifies src/test/util/time.h, specifically the default constructor of NodeClockContext. Previously it called set(++Now
Changed components
src/test/util/time.hNodeClockContext default constructorInspect captured patch +2 / −2
diff --git a/src/test/util/time.h b/src/test/util/time.h
index 8cd9a1da..72dfd0e7 100644
--- a/src/test/util/time.h
+++ b/src/test/util/time.h
@@ -44,8 +44,8 @@ public:
/// Initialize with the given time.
explicit NodeClockContext(NodeSeconds init_time) { set(init_time); }
explicit NodeClockContext(std::chrono::seconds init_time) { set(init_time); }
- /// Initialize with current time, using the next tick to avoid going back by rounding to seconds.
- explicit NodeClockContext() { set(++Now<NodeSeconds>().time_since_epoch()); }
+ /// Initialize with current time.
+ explicit NodeClockContext() { set(Now<NodeSeconds>()); }
/// Unset mocktime.
~NodeClockContext() { set(0s); }
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.