From 7c4a044ec5f7ada1f128860dfd05eaaf4d089e19 Mon Sep 17 00:00:00 2001 From: Prasanna Loganathar Date: Fri, 3 Jun 2022 12:12:02 +0530 Subject: [PATCH 1/2] Improve mocknet simulation params --- src/chainparams.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index f38480304ea..f62a41d6298 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -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); } } @@ -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 } @@ -989,8 +991,6 @@ 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 @@ -999,6 +999,9 @@ void CMainParams::UpdateActivationParametersFromArgs() { LogPrintf("mocknet: key: %s\n", sMockFoundationPubKey); } } + + // Do this at the end, to ensure simualte mainnet overrides are in place. + SetupCommonArgActivationParams(consensus); } From 50b1c5d15df46100da84a591a5b6549a44eee7a1 Mon Sep 17 00:00:00 2001 From: Prasanna Loganathar Date: Fri, 3 Jun 2022 12:15:44 +0530 Subject: [PATCH 2/2] Move additional params only on mocknet guard --- src/chainparams.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index f62a41d6298..b674357543a 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -998,10 +998,10 @@ void CMainParams::UpdateActivationParametersFromArgs() { 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); + // Do this at the end, to ensure simualte mainnet overrides are in place. + SetupCommonArgActivationParams(consensus); + } }