From c445333d85ca7c14029e33acd80fc286409bec89 Mon Sep 17 00:00:00 2001 From: furszy Date: Fri, 14 Jan 2022 17:26:54 -0300 Subject: [PATCH] init: add flag to disable the DKG processes. Updating p2p_quorum_connect.py test with it And move -pushversion to GetTierTwoHelpString as well. --- src/init.cpp | 5 ----- src/tiertwo/init.cpp | 20 +++++++++++++++++--- test/functional/p2p_quorum_connect.py | 2 +- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index a6dab6e2a4403..60267be8a9a7a 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -511,11 +511,6 @@ std::string HelpMessage(HelpMessageMode mode) AppendParamsHelpMessages(strUsage, showDebug); strUsage += GetTierTwoHelpString(showDebug); - if (showDebug) { - strUsage += HelpMessageOpt("-pushversion", - strprintf("Modifies the mnauth serialization if the version is lower than %d." - "testnet/regtest only; ", MNAUTH_NODE_VER_VERSION)); - } strUsage += HelpMessageGroup("Node relay options:"); if (showDebug) { diff --git a/src/tiertwo/init.cpp b/src/tiertwo/init.cpp index 67a819a86a9ac..9857f68f7164a 100644 --- a/src/tiertwo/init.cpp +++ b/src/tiertwo/init.cpp @@ -29,6 +29,11 @@ std::string GetTierTwoHelpString(bool showDebug) strUsage += HelpMessageOpt("-masternodeaddr=", strprintf("Set external address:port to get to this masternode (example: %s)", "128.127.106.235:51472")); strUsage += HelpMessageOpt("-budgetvotemode=", "Change automatic finalized budget voting behavior. mode=auto: Vote for only exact finalized budget match to my generated budget. (string, default: auto)"); strUsage += HelpMessageOpt("-mnoperatorprivatekey=", "Set the masternode operator private key. Only valid with -masternode=1. When set, the masternode acts as a deterministic masternode."); + if (showDebug) { + strUsage += HelpMessageOpt("-pushversion", strprintf("Modifies the mnauth serialization if the version is lower than %d." + "testnet/regtest only; ", MNAUTH_NODE_VER_VERSION)); + strUsage += HelpMessageOpt("-disabledkg", "Disable the DKG sessions process threads for the entire lifecycle. testnet/regtest only."); + } return strUsage; } @@ -235,8 +240,17 @@ bool InitActiveMN() void StartTierTwoThreadsAndScheduleJobs(boost::thread_group& threadGroup, CScheduler& scheduler) { threadGroup.create_thread(std::bind(&ThreadCheckMasternodes)); - // start LLMQ system - llmq::StartLLMQSystem(); + + // Start LLMQ system + if (gArgs.GetBoolArg("-disabledkg", false)) { + if (Params().NetworkIDString() == CBaseChainParams::MAIN) { + throw std::runtime_error("DKG system can be disabled only on testnet/regtest"); + } else { + LogPrintf("DKG system disabled.\n"); + } + } else { + llmq::StartLLMQSystem(); + } } void StopTierTwoThreads() @@ -249,4 +263,4 @@ void DeleteTierTwo() llmq::DestroyLLMQSystem(); deterministicMNManager.reset(); evoDb.reset(); -} \ No newline at end of file +} diff --git a/test/functional/p2p_quorum_connect.py b/test/functional/p2p_quorum_connect.py index f6160d5ccb740..8cd199c037b50 100755 --- a/test/functional/p2p_quorum_connect.py +++ b/test/functional/p2p_quorum_connect.py @@ -32,7 +32,7 @@ def set_test_params(self): self.minerPos = 0 self.controllerPos = 1 self.setup_clean_chain = True - self.extra_args = [["-nuparams=v5_shield:1", "-nuparams=v6_evo:101"]] * self.num_nodes + self.extra_args = [["-nuparams=v5_shield:1", "-nuparams=v6_evo:101", "-disabledkg"]] * self.num_nodes self.extra_args[0].append("-sporkkey=932HEevBSujW2ud7RfB1YF91AFygbBRQj3de3LyaCRqNzKKgWXi") def add_new_dmn(self, mns, strType, op_keys=None, from_out=None):