few trivial fixes in init.cpp (#1155)

* few trivial fixes in init.cpp

* DEFAULT_PRIVATESEND_LIQUIDITY

* fix InitParameterInteraction
This commit is contained in:
UdjinM6 2016-11-20 10:52:23 +04:00 committed by GitHub
parent e59bee8114
commit e121829e40
3 changed files with 14 additions and 12 deletions

View File

@ -20,7 +20,7 @@
int nPrivateSendRounds = DEFAULT_PRIVATESEND_ROUNDS; int nPrivateSendRounds = DEFAULT_PRIVATESEND_ROUNDS;
int nPrivateSendAmount = DEFAULT_PRIVATESEND_AMOUNT; int nPrivateSendAmount = DEFAULT_PRIVATESEND_AMOUNT;
int nLiquidityProvider = 0; int nLiquidityProvider = DEFAULT_PRIVATESEND_LIQUIDITY;
bool fEnablePrivateSend = false; bool fEnablePrivateSend = false;
bool fPrivateSendMultiSession = DEFAULT_PRIVATESEND_MULTISESSION; bool fPrivateSendMultiSession = DEFAULT_PRIVATESEND_MULTISESSION;

View File

@ -27,6 +27,7 @@ static const int DENOMS_COUNT_MAX = 100;
static const int DEFAULT_PRIVATESEND_ROUNDS = 2; static const int DEFAULT_PRIVATESEND_ROUNDS = 2;
static const int DEFAULT_PRIVATESEND_AMOUNT = 1000; static const int DEFAULT_PRIVATESEND_AMOUNT = 1000;
static const int DEFAULT_PRIVATESEND_LIQUIDITY = 0;
static const bool DEFAULT_PRIVATESEND_MULTISESSION = false; static const bool DEFAULT_PRIVATESEND_MULTISESSION = false;
// Warn user if mixing in gui or try to create backup if mixing in daemon mode // Warn user if mixing in gui or try to create backup if mixing in daemon mode

View File

@ -565,14 +565,14 @@ std::string HelpMessage(HelpMessageMode mode)
strUsage += HelpMessageGroup(_("PrivateSend options:")); strUsage += HelpMessageGroup(_("PrivateSend options:"));
strUsage += HelpMessageOpt("-enableprivatesend=<n>", strprintf(_("Enable use of automated PrivateSend for funds stored in this wallet (0-1, default: %u)"), 0)); strUsage += HelpMessageOpt("-enableprivatesend=<n>", strprintf(_("Enable use of automated PrivateSend for funds stored in this wallet (0-1, default: %u)"), 0));
strUsage += HelpMessageOpt("-privatesendmultisession=<n>", strprintf(_("Enable multiple PrivateSend mixing sessions per block, experimental (0-1, default: %u)"), DEFAULT_PRIVATESEND_MULTISESSION)); strUsage += HelpMessageOpt("-privatesendmultisession=<n>", strprintf(_("Enable multiple PrivateSend mixing sessions per block, experimental (0-1, default: %u)"), DEFAULT_PRIVATESEND_MULTISESSION));
strUsage += HelpMessageOpt("-privatesendrounds=<n>", strprintf(_("Use N separate masternodes to anonymize funds (2-8, default: %u)"), DEFAULT_PRIVATESEND_ROUNDS)); strUsage += HelpMessageOpt("-privatesendrounds=<n>", strprintf(_("Use N separate masternodes for each denominated input to mix funds (2-16, default: %u)"), DEFAULT_PRIVATESEND_ROUNDS));
strUsage += HelpMessageOpt("-privatesendamount=<n>", strprintf(_("Keep N DASH anonymized (default: %u)"), DEFAULT_PRIVATESEND_AMOUNT)); strUsage += HelpMessageOpt("-privatesendamount=<n>", strprintf(_("Keep N DASH anonymized (default: %u)"), DEFAULT_PRIVATESEND_AMOUNT));
strUsage += HelpMessageOpt("-liquidityprovider=<n>", strprintf(_("Provide liquidity to PrivateSend by infrequently mixing coins on a continual basis (0-100, default: %u, 1=very frequent, high fees, 100=very infrequent, low fees)"), nLiquidityProvider)); strUsage += HelpMessageOpt("-liquidityprovider=<n>", strprintf(_("Provide liquidity to PrivateSend by infrequently mixing coins on a continual basis (0-100, default: %u, 1=very frequent, high fees, 100=very infrequent, low fees)"), DEFAULT_PRIVATESEND_LIQUIDITY));
strUsage += HelpMessageGroup(_("InstantSend options:")); strUsage += HelpMessageGroup(_("InstantSend options:"));
strUsage += HelpMessageOpt("-enableinstantsend=<n>", strprintf(_("Enable InstantSend, show confirmations for locked transactions (0-1, default: %u)"), 1)); strUsage += HelpMessageOpt("-enableinstantsend=<n>", strprintf(_("Enable InstantSend, show confirmations for locked transactions (0-1, default: %u)"), 1));
strUsage += HelpMessageOpt("-instantsenddepth=<n>", strprintf(_("Show N confirmations for a successfully locked transaction (0-9999, default: %u)"), DEFAULT_INSTANTSEND_DEPTH)); strUsage += HelpMessageOpt("-instantsenddepth=<n>", strprintf(_("Show N confirmations for a successfully locked transaction (0-9999, default: %u)"), DEFAULT_INSTANTSEND_DEPTH));
strUsage += HelpMessageOpt("-instantsendnotify=<cmd>", _("Execute command when a wallet IS transaction is successfully locked (%s in cmd is replaced by TxID)")); strUsage += HelpMessageOpt("-instantsendnotify=<cmd>", _("Execute command when a wallet InstantSend transaction is successfully locked (%s in cmd is replaced by TxID)"));
strUsage += HelpMessageGroup(_("Node relay options:")); strUsage += HelpMessageGroup(_("Node relay options:"));
@ -864,19 +864,19 @@ void InitParameterInteraction()
if(!GetBoolArg("-enableinstantsend", fEnableInstantSend)){ if(!GetBoolArg("-enableinstantsend", fEnableInstantSend)){
if (SoftSetArg("-instantsenddepth", 0)) if (SoftSetArg("-instantsenddepth", 0))
LogPrintf("AppInit2 : parameter interaction: -enableinstantsend=false -> setting -nInstantSendDepth=0\n"); LogPrintf("%s: parameter interaction: -enableinstantsend=false -> setting -nInstantSendDepth=0\n", __func__);
} }
if (GetArg("-liquidityprovider", 0) > 0) { int nLiqProvTmp = GetArg("-liquidityprovider", DEFAULT_PRIVATESEND_LIQUIDITY);
int nLiqProvTmp = GetArg("-liquidityprovider", 0); if (nLiqProvTmp > 0) {
mapArgs["-enableprivatesend"] = "1"; mapArgs["-enableprivatesend"] = "1";
LogPrintf("AppInit2 : parameter interaction: -liquidityprovider=%d -> setting -enableprivatesend=1\n", nLiqProvTmp); LogPrintf("%s: parameter interaction: -liquidityprovider=%d -> setting -enableprivatesend=1\n", __func__, nLiqProvTmp);
mapArgs["-privatesendrounds"] = "99999"; mapArgs["-privatesendrounds"] = "99999";
LogPrintf("AppInit2 : parameter interaction: -liquidityprovider=%d -> setting -privatesendrounds=99999\n", nLiqProvTmp); LogPrintf("%s: parameter interaction: -liquidityprovider=%d -> setting -privatesendrounds=99999\n", __func__, nLiqProvTmp);
mapArgs["-privatesendamount"] = "999999"; mapArgs["-privatesendamount"] = "999999";
LogPrintf("AppInit2 : parameter interaction: -liquidityprovider=%d -> setting -privatesendamount=999999\n", nLiqProvTmp); LogPrintf("%s: parameter interaction: -liquidityprovider=%d -> setting -privatesendamount=999999\n", __func__, nLiqProvTmp);
mapArgs["-privatesendmultisession"] = "0"; mapArgs["-privatesendmultisession"] = "0";
LogPrintf("AppInit2 : parameter interaction: -liquidityprovider=%d -> setting -privatesendmultisession=0\n", nLiqProvTmp); LogPrintf("%s: parameter interaction: -liquidityprovider=%d -> setting -privatesendmultisession=0\n", __func__, nLiqProvTmp);
} }
} }
@ -1833,7 +1833,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
fEnablePrivateSend = GetBoolArg("-enableprivatesend", 0); fEnablePrivateSend = GetBoolArg("-enableprivatesend", 0);
fPrivateSendMultiSession = GetBoolArg("-privatesendmultisession", DEFAULT_PRIVATESEND_MULTISESSION); fPrivateSendMultiSession = GetBoolArg("-privatesendmultisession", DEFAULT_PRIVATESEND_MULTISESSION);
nPrivateSendRounds = GetArg("-privatesendrounds", DEFAULT_PRIVATESEND_ROUNDS); nPrivateSendRounds = GetArg("-privatesendrounds", DEFAULT_PRIVATESEND_ROUNDS);
nPrivateSendRounds = std::min(std::max(nPrivateSendRounds, 1), 99999); nPrivateSendRounds = std::min(std::max(nPrivateSendRounds, 2), nLiquidityProvider ? 99999 : 16);
nPrivateSendAmount = GetArg("-privatesendamount", DEFAULT_PRIVATESEND_AMOUNT); nPrivateSendAmount = GetArg("-privatesendamount", DEFAULT_PRIVATESEND_AMOUNT);
nPrivateSendAmount = std::min(std::max(nPrivateSendAmount, 2), 999999); nPrivateSendAmount = std::min(std::max(nPrivateSendAmount, 2), 999999);
@ -1870,6 +1870,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
return InitError("Failed to load masternode payments cache from mnpayments.dat"); return InitError("Failed to load masternode payments cache from mnpayments.dat");
} }
uiInterface.InitMessage(_("Loading governance cache..."));
CFlatDB<CGovernanceManager> flatdb3("governance.dat", "magicGovernanceCache"); CFlatDB<CGovernanceManager> flatdb3("governance.dat", "magicGovernanceCache");
if(!flatdb3.Load(governance)) { if(!flatdb3.Load(governance)) {
return InitError("Failed to load governance cache from governance.dat"); return InitError("Failed to load governance cache from governance.dat");