mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 07:09:15 +01:00
Merge bitcoin/bitcoin#32927: fuzz: Add missing calls to SetMockTime for determinism
fa8862723cfuzz: CheckGlobals in init (MarcoFalke)fa26bfde98test: Avoid resetting mocktime in testing setup (MarcoFalke)fa6b45fa8eAdd 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: ACKfa8862723cdergoegge: utACKfa8862723cTree-SHA512: 5a9400f0467c82fa224713af4cc2b525afbefefc7c3f419077110925ad7af6c7fda3dcd2b50f7facf0ee7df2547c6ac20336906d707adcdfd1d652a9d9a735fe
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user