From 40499466251a12bc20d64ddee7298c32ab216fd8 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Fri, 20 Nov 2015 17:03:57 +0300 Subject: [PATCH] init params: - use defaults in cmd line args/help - make liquidity provider param interaction more verbose - allow to override UI restrictions (rounds/amount) from cmd line --- src/init.cpp | 50 +++++++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index 34bc580f19..d998577516 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -418,14 +418,14 @@ std::string HelpMessage(HelpMessageMode mode) strUsage += " -budgetvotemode= " + _("Change automatic finalized budget voting behavior. mode=auto: Vote for only exact finalized budget match to my generated budget. (string, default: auto)") + "\n"; strUsage += "\n" + _("Darksend options:") + "\n"; - strUsage += " -enabledarksend= " + strprintf(_("Enable use of automated darksend for funds stored in this wallet (0-1, default: %u)"), 0) + "\n"; - strUsage += " -darksendmultisession= " + strprintf(_("Enable multiple darksend mixing sessions per block, experimental (0-1, default: %u)"), 0) + "\n"; - strUsage += " -darksendrounds= " + strprintf(_("Use N separate masternodes to anonymize funds (2-8, default: %u)"), 2) + "\n"; - strUsage += " -anonymizedashamount= " + strprintf(_("Keep N DASH anonymized (default: %u)"), 0) + "\n"; - strUsage += " -liquidityprovider= " + strprintf(_("Provide liquidity to Darksend by infrequently mixing coins on a continual basis (0-100, default: %u, 1=very frequent, high fees, 100=very infrequent, low fees)"), 0) + "\n"; + strUsage += " -enabledarksend= " + strprintf(_("Enable use of automated darksend for funds stored in this wallet (0-1, default: %u)"), fEnableDarksend) + "\n"; + strUsage += " -darksendmultisession= " + strprintf(_("Enable multiple darksend mixing sessions per block, experimental (0-1, default: %u)"), fDarksendMultiSession) + "\n"; + strUsage += " -darksendrounds= " + strprintf(_("Use N separate masternodes to anonymize funds (2-8, default: %u)"), nDarksendRounds) + "\n"; + strUsage += " -anonymizedashamount= " + strprintf(_("Keep N DASH anonymized (default: %u)"), nAnonymizeDarkcoinAmount) + "\n"; + strUsage += " -liquidityprovider= " + strprintf(_("Provide liquidity to Darksend by infrequently mixing coins on a continual basis (0-100, default: %u, 1=very frequent, high fees, 100=very infrequent, low fees)"), nLiquidityProvider) + "\n"; strUsage += "\n" + _("InstantX options:") + "\n"; - strUsage += " -enableinstantx= " + strprintf(_("Enable instantx, show confirmations for locked transactions (bool, default: %s)"), "true") + "\n"; + strUsage += " -enableinstantx= " + strprintf(_("Enable instantx, show confirmations for locked transactions (0-1, default: %u)"), fEnableInstantX) + "\n"; strUsage += " -instantxdepth= " + strprintf(_("Show N confirmations for a successfully locked transaction (0-9999, default: %u)"), nInstantXDepth) + "\n"; strUsage += "\n" + _("Node relay options:") + "\n"; @@ -704,6 +704,18 @@ bool AppInit2(boost::thread_group& threadGroup) LogPrintf("AppInit2 : parameter interaction: -enableinstantx=false -> setting -nInstantXDepth=0\n"); } + if (GetArg("-liquidityprovider", 0) > 0) { + int nLiqProvTmp = GetArg("-liquidityprovider", 0); + mapArgs["-enabledarksend"] = "1"; + LogPrintf("AppInit2 : parameter interaction: -liquidityprovider=%d -> setting -enabledarksend=1\n", nLiqProvTmp); + mapArgs["-darksendrounds"] = "99999"; + LogPrintf("AppInit2 : parameter interaction: -liquidityprovider=%d -> setting -darksendrounds=99999\n", nLiqProvTmp); + mapArgs["-anonymizedashamount"] = "999999"; + LogPrintf("AppInit2 : parameter interaction: -liquidityprovider=%d -> setting -anonymizedashamount=999999\n", nLiqProvTmp); + mapArgs["-darksendmultisession"] = "0"; + LogPrintf("AppInit2 : parameter interaction: -liquidityprovider=%d -> setting -darksendmultisession=0\n", nLiqProvTmp); + } + // Make sure enough file descriptors are available int nBind = std::max((int)mapArgs.count("-bind") + (int)mapArgs.count("-whitebind"), 1); nMaxConnections = GetArg("-maxconnections", 125); @@ -1521,24 +1533,16 @@ bool AppInit2(boost::thread_group& threadGroup) } } - fEnableDarksend = GetBoolArg("-enabledarksend", false); - fDarksendMultiSession = GetBoolArg("-darksendmultisession", false); + nLiquidityProvider = GetArg("-liquidityprovider", nLiquidityProvider); + nLiquidityProvider = std::min(std::max(nLiquidityProvider, 0), 100); + darkSendPool.SetMinBlockSpacing(nLiquidityProvider * 15); - nDarksendRounds = GetArg("-darksendrounds", 2); - if(nDarksendRounds > 16) nDarksendRounds = 16; - if(nDarksendRounds < 1) nDarksendRounds = 1; - - nLiquidityProvider = GetArg("-liquidityprovider", 0); //0-100 - if(nLiquidityProvider != 0) { - darkSendPool.SetMinBlockSpacing(std::min(nLiquidityProvider,100)*15); - fEnableDarksend = true; - nDarksendRounds = 99999; - fDarksendMultiSession = false; - } - - nAnonymizeDarkcoinAmount = GetArg("-anonymizedashamount", 0); - if(nAnonymizeDarkcoinAmount > 999999) nAnonymizeDarkcoinAmount = 999999; - if(nAnonymizeDarkcoinAmount < 2) nAnonymizeDarkcoinAmount = 2; + fEnableDarksend = GetBoolArg("-enabledarksend", fEnableDarksend); + fDarksendMultiSession = GetBoolArg("-darksendmultisession", fDarksendMultiSession); + nDarksendRounds = GetArg("-darksendrounds", nDarksendRounds); + nDarksendRounds = std::min(std::max(nDarksendRounds, 1), 99999); + nAnonymizeDarkcoinAmount = GetArg("-anonymizedashamount", nAnonymizeDarkcoinAmount); + nAnonymizeDarkcoinAmount = std::min(std::max(nAnonymizeDarkcoinAmount, 2), 999999); fEnableInstantX = GetBoolArg("-enableinstantx", fEnableInstantX); nInstantXDepth = GetArg("-instantxdepth", nInstantXDepth);