Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve mocknet simulation params #1323

Merged
merged 2 commits into from
Jun 3, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -968,6 +968,8 @@ void SetupCommonArgActivationParams(Consensus::Params &consensus) {
consensus.pos.nTargetTimespan = 5 * 60; // 5 min == 10 blocks
consensus.pos.nTargetSpacing = 30; // seconds
consensus.pos.nTargetTimespanV2 = 1008 * consensus.pos.nTargetSpacing; // 1008 blocks
LogPrintf("conf: simulatemainnet: true (Re-adjusted: blocktime=%ds, difficultytimespan=%ds)\n",
consensus.pos.nTargetSpacing, consensus.pos.nTargetTimespanV2);
}
}

Expand All @@ -979,7 +981,7 @@ void CMainParams::UpdateActivationParametersFromArgs() {
LogPrintf("WARNING: MOCKNET ACTIVE. THIS IS NOT MAINNET\n");
LogPrintf("============================================\n");
auto sMockFoundationPubKey = gArgs.GetArg("-mocknet-key", "");
auto nMockBlockTimeSecs = gArgs.GetArg("-mocknet-blocktime", 10);
auto nMockBlockTimeSecs = gArgs.GetArg("-mocknet-blocktime", 30);
if (!gArgs.IsArgSet("-maxtipage")) {
gArgs.ForceSetArg("-maxtipage", "2207520000"); // 10 years
}
Expand All @@ -989,15 +991,16 @@ void CMainParams::UpdateActivationParametersFromArgs() {
consensus.pos.nTargetTimespanV2 = 10 * consensus.pos.nTargetSpacing;
consensus.pos.allowMintingWithoutPeers = true;

SetupCommonArgActivationParams(consensus);

LogPrintf("mocknet: block-time: %s secs\n", consensus.pos.nTargetSpacing);

// Add additional foundation members here for testing
if (!sMockFoundationPubKey.empty()) {
consensus.foundationMembers.insert(GetScriptForDestination(DecodeDestination(sMockFoundationPubKey, *this)));
LogPrintf("mocknet: key: %s\n", sMockFoundationPubKey);
}

// Do this at the end, to ensure simualte mainnet overrides are in place.
SetupCommonArgActivationParams(consensus);
}
}

Expand Down