What changed, and why it matters
This commit is a minor code cleanup inside a fuzz test (automated randomized testing) for Bitcoin's header synchronization logic. It replaces a manual check that skipped invalid mock times with a built-in minimum-time option in the test helper. There is no change to production Bitcoin node code, no user-facing behavior change, and no security fix.
No action required. This is a non-security test refactor.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change modifies src/test/fuzz/headerssync.cpp. Previously the fuzz target called ConsumeTime() and manually returned early if the generated mock_time was below the genesis median-time-past. Now it passes start_index.GetMedianTimePast() as the min argument to ConsumeTime() and directly uses the result with SetMockTime(). This is purely a refactor of fuzz-test harness code; the same lower bound is enforced, just inside the helper. No consensus, P2P, or wallet code is touched.
Changed components
src/test/fuzz/headerssync.cppInspect captured patch +1 / −3
diff --git a/src/test/fuzz/headerssync.cpp b/src/test/fuzz/headerssync.cpp
index b33f4dc7..f6e574f4 100644
--- a/src/test/fuzz/headerssync.cpp
+++ b/src/test/fuzz/headerssync.cpp
@@ -55,13 +55,11 @@ FUZZ_TARGET(headers_sync_state, .init = initialize_headers_sync_state_fuzz)
{
SeedRandomStateForTest(SeedRand::ZEROS);
FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
- auto mock_time{ConsumeTime(fuzzed_data_provider)};
CBlockHeader genesis_header{Params().GenesisBlock()};
CBlockIndex start_index(genesis_header);
- if (mock_time < start_index.GetMedianTimePast()) return;
- SetMockTime(mock_time);
+ SetMockTime(ConsumeTime(fuzzed_data_provider, /*min=*/start_index.GetMedianTimePast()));
const uint256 genesis_hash = genesis_header.GetHash();
start_index.phashBlock = &genesis_hash;
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.