Merge bitcoin/bitcoin#32927: fuzz: Add missing calls to SetMockTime for determinism

fa8862723c fuzz: CheckGlobals in init (MarcoFalke)
fa26bfde98 test: Avoid resetting mocktime in testing setup (MarcoFalke)
fa6b45fa8e Add SetMockTime for time_point types (MarcoFalke)

Pull request description:

  (Tracking issue https://github.com/bitcoin/bitcoin/issues/29018)

  During fuzzing, `AppInitParameterInteraction` may actually disable a previously set mocktime. This is confusing and can also cause non-determinism.

  Fix this issue, by

  * fixing the erroneous `-mocktime` parsing in `AppInitParameterInteraction`.
  * adding the missing `SetMockTime` calls to the affected fuzz init functions.
  * adding a `CheckGlobals` to the fuzz init, to prevent this issue in the future.

  This can be tested by

  * Cherry-picking the `CheckGlobals`-commit onto current master and observing a fuzz failure in the touched fuzz targets.
  * Reverting the touched fuzz fixups and observing a fuzz failure for each target.

ACKs for top commit:
  w0xlt:
    ACK fa8862723c
  dergoegge:
    utACK fa8862723c

Tree-SHA512: 5a9400f0467c82fa224713af4cc2b525afbefefc7c3f419077110925ad7af6c7fda3dcd2b50f7facf0ee7df2547c6ac20336906d707adcdfd1d652a9d9a735fe
This commit is contained in:
merge-script
2025-07-11 11:18:03 +01:00
10 changed files with 12 additions and 3 deletions

View File

@@ -1052,7 +1052,9 @@ bool AppInitParameterInteraction(const ArgsManager& args)
if (!g_wallet_init_interface.ParameterInteraction()) return false;
// Option to startup with mocktime set (used for regression testing):
SetMockTime(args.GetIntArg("-mocktime", 0)); // SetMockTime(0) is a no-op
if (const auto mocktime{args.GetIntArg("-mocktime")}) {
SetMockTime(std::chrono::seconds{*mocktime});
}
if (args.GetBoolArg("-peerbloomfilters", DEFAULT_PEERBLOOMFILTERS))
g_local_services = ServiceFlags(g_local_services | NODE_BLOOM);