Skip to content

Commit

Permalink
Merge bitcoin#1946: Testing framework, adding mocktime startup arg.
Browse files Browse the repository at this point in the history
bde4f4b Adding mocktime startup arg. (furszy)

Pull request description:

  Startup option to initialize the node with mocktime set (regression testing only).
  Hidden issue: the functional testing framework is already trying to use it without any luck as the startup option doesn't exist. (`TestNode` class, line 70).

  Extra notes, this fixes bitcoin#1916 tier two functional testing sync issues.

ACKs for top commit:
  random-zebra:
    great find! utACK bde4f4b
  Fuzzbawls:
    utACK bde4f4b

Tree-SHA512: bbf6b116edf0cbd0fb754878e261c6fbaa7aff1e6b0e74894bf2ffa780cfdf7581c30e8af736283a12597e6e60c37694c9adbf388fefb56a38bfc5245632e412
  • Loading branch information
random-zebra committed Oct 29, 2020
2 parents 1fd7a25 + bde4f4b commit 98c6183
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ std::string HelpMessage(HelpMessageMode mode)
strUsage += HelpMessageOpt("-logtimestamps", strprintf(_("Prepend debug output with timestamp (default: %u)"), DEFAULT_LOGTIMESTAMPS));
strUsage += HelpMessageOpt("-logtimemicros", strprintf("Add microsecond precision to debug timestamps (default: %u)", DEFAULT_LOGTIMEMICROS));
if (showDebug) {
strUsage += HelpMessageOpt("-mocktime=<n>", "Replace actual time with <n> seconds since epoch (default: 0)");
strUsage += HelpMessageOpt("-limitfreerelay=<n>", strprintf(_("Continuously rate-limit free transactions to <n>*1000 bytes per minute (default:%u)"), DEFAULT_LIMITFREERELAY));
strUsage += HelpMessageOpt("-relaypriority", strprintf(_("Require high priority for relaying free or low-fee transactions (default:%u)"), DEFAULT_RELAYPRIORITY));
strUsage += HelpMessageOpt("-maxsigcachesize=<n>", strprintf(_("Limit size of signature cache to <n> MiB (default: %u)"), DEFAULT_MAX_SIG_CACHE_SIZE));
Expand Down Expand Up @@ -1119,6 +1120,11 @@ bool AppInit2()
fIsBareMultisigStd = gArgs.GetBoolArg("-permitbaremultisig", DEFAULT_PERMIT_BAREMULTISIG);
nMaxDatacarrierBytes = gArgs.GetArg("-datacarriersize", nMaxDatacarrierBytes);

// Option to startup with mocktime set (used for regression testing):
if (Params().IsRegTestNet()) {
SetMockTime(gArgs.GetArg("-mocktime", 0)); // SetMockTime(0) is a no-op
}

ServiceFlags nLocalServices = NODE_NETWORK;
ServiceFlags nRelevantServices = NODE_NETWORK;

Expand Down

0 comments on commit 98c6183

Please sign in to comment.