Skip to content

Commit

Permalink
Merge #918: Change anonymizedashamount -> privatesendamount for consi…
Browse files Browse the repository at this point in the history
…stency

74f2725 Change anonymizedashamount -> privatesendamount for consistency
  • Loading branch information
UdjinM6 authored and schinzelh committed Jul 29, 2016
1 parent ee17056 commit 0c65a9c
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 40 deletions.
12 changes: 6 additions & 6 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ std::string HelpMessage(HelpMessageMode mode)
strUsage += HelpMessageOpt("-enableprivatesend=<n>", strprintf(_("Enable use of automated PrivateSend for funds stored in this wallet (0-1, default: %u)"), fEnablePrivateSend));
strUsage += HelpMessageOpt("-privatesendmultisession=<n>", strprintf(_("Enable multiple PrivateSend mixing sessions per block, experimental (0-1, default: %u)"), fPrivateSendMultiSession));
strUsage += HelpMessageOpt("-privatesendrounds=<n>", strprintf(_("Use N separate masternodes to anonymize funds (2-8, default: %u)"), nPrivateSendRounds));
strUsage += HelpMessageOpt("-anonymizedashamount=<n>", strprintf(_("Keep N DASH anonymized (default: %u)"), nAnonymizeDashAmount));
strUsage += HelpMessageOpt("-privatesendamount=<n>", strprintf(_("Keep N DASH anonymized (default: %u)"), nPrivateSendAmount));
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 += HelpMessageGroup(_("InstantSend options:"));
Expand Down Expand Up @@ -866,8 +866,8 @@ void InitParameterInteraction()
LogPrintf("AppInit2 : parameter interaction: -liquidityprovider=%d -> setting -enableprivatesend=1\n", nLiqProvTmp);
mapArgs["-privatesendrounds"] = "99999";
LogPrintf("AppInit2 : parameter interaction: -liquidityprovider=%d -> setting -privatesendrounds=99999\n", nLiqProvTmp);
mapArgs["-anonymizedashamount"] = "999999";
LogPrintf("AppInit2 : parameter interaction: -liquidityprovider=%d -> setting -anonymizedashamount=999999\n", nLiqProvTmp);
mapArgs["-privatesendamount"] = "999999";
LogPrintf("AppInit2 : parameter interaction: -liquidityprovider=%d -> setting -privatesendamount=999999\n", nLiqProvTmp);
mapArgs["-privatesendmultisession"] = "0";
LogPrintf("AppInit2 : parameter interaction: -liquidityprovider=%d -> setting -privatesendmultisession=0\n", nLiqProvTmp);
}
Expand Down Expand Up @@ -1829,8 +1829,8 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
fPrivateSendMultiSession = GetBoolArg("-privatesendmultisession", fPrivateSendMultiSession);
nPrivateSendRounds = GetArg("-privatesendrounds", nPrivateSendRounds);
nPrivateSendRounds = std::min(std::max(nPrivateSendRounds, 1), 99999);
nAnonymizeDashAmount = GetArg("-anonymizedashamount", nAnonymizeDashAmount);
nAnonymizeDashAmount = std::min(std::max(nAnonymizeDashAmount, 2), 999999);
nPrivateSendAmount = GetArg("-privatesendamount", nPrivateSendAmount);
nPrivateSendAmount = std::min(std::max(nPrivateSendAmount, 2), 999999);

fEnableInstantSend = GetBoolArg("-enableinstantsend", fEnableInstantSend);
nInstantSendDepth = GetArg("-instantsenddepth", nInstantSendDepth);
Expand All @@ -1845,7 +1845,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
LogPrintf("fLiteMode %d\n", fLiteMode);
LogPrintf("nInstantSendDepth %d\n", nInstantSendDepth);
LogPrintf("PrivateSend rounds %d\n", nPrivateSendRounds);
LogPrintf("Anonymize Dash Amount %d\n", nAnonymizeDashAmount);
LogPrintf("PrivateSend amount %d\n", nPrivateSendAmount);
LogPrintf("Budget Mode %s\n", strBudgetMode);

darkSendPool.InitDenominations();
Expand Down
4 changes: 2 additions & 2 deletions src/qt/darksendconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ void DarksendConfig::configure(bool enabled, int coins, int rounds) {
QSettings settings;

settings.setValue("nPrivateSendRounds", rounds);
settings.setValue("nAnonymizeDashAmount", coins);
settings.setValue("nPrivateSendAmount", coins);

nPrivateSendRounds = rounds;
nAnonymizeDashAmount = coins;
nPrivateSendAmount = coins;
}
2 changes: 1 addition & 1 deletion src/qt/forms/optionsdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@
</widget>
</item>
<item>
<widget class="QSpinBox" name="anonymizeDash">
<widget class="QSpinBox" name="privateSendAmount">
<property name="minimum">
<number>2</number>
</property>
Expand Down
2 changes: 1 addition & 1 deletion src/qt/optionsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ void OptionsDialog::setMapper()
mapper->addMapping(ui->showAdvancedPSUI, OptionsModel::ShowAdvancedPSUI);
mapper->addMapping(ui->coinControlFeatures, OptionsModel::CoinControlFeatures);
mapper->addMapping(ui->privateSendRounds, OptionsModel::PrivateSendRounds);
mapper->addMapping(ui->anonymizeDash, OptionsModel::AnonymizeDashAmount);
mapper->addMapping(ui->privateSendAmount, OptionsModel::PrivateSendAmount);
mapper->addMapping(ui->privateSendMultiSession, OptionsModel::PrivateSendMultiSession);

/* Network */
Expand Down
28 changes: 14 additions & 14 deletions src/qt/optionsmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,16 @@ void OptionsModel::Init(bool resetSettings)
addOverriddenOption("-privatesendrounds");
nPrivateSendRounds = settings.value("nPrivateSendRounds").toInt();

if (!settings.contains("nAnonymizeDashAmount")) {
if (!settings.contains("nPrivateSendAmount")) {
// for migration from old settings
if (!settings.contains("nAnonymizeDarkcoinAmount"))
settings.setValue("nAnonymizeDashAmount", 1000);
if (!settings.contains("nAnonymizeDashAmount"))
settings.setValue("nPrivateSendAmount", 1000);
else
settings.setValue("nAnonymizeDashAmount", settings.value("nAnonymizeDarkcoinAmount").toInt());
settings.setValue("nPrivateSendAmount", settings.value("nAnonymizeDashAmount").toInt());
}
if (!SoftSetArg("-anonymizedashamount", settings.value("nAnonymizeDashAmount").toString().toStdString()))
addOverriddenOption("-anonymizedashamount");
nAnonymizeDashAmount = settings.value("nAnonymizeDashAmount").toInt();
if (!SoftSetArg("-privatesendamount", settings.value("nPrivateSendAmount").toString().toStdString()))
addOverriddenOption("-privatesendamount");
nPrivateSendAmount = settings.value("nPrivateSendAmount").toInt();

if (!settings.contains("fPrivateSendMultiSession"))
settings.setValue("fPrivateSendMultiSession", fPrivateSendMultiSession);
Expand Down Expand Up @@ -253,8 +253,8 @@ QVariant OptionsModel::data(const QModelIndex & index, int role) const
return fShowAdvancedPSUI;
case PrivateSendRounds:
return settings.value("nPrivateSendRounds");
case AnonymizeDashAmount:
return settings.value("nAnonymizeDashAmount");
case PrivateSendAmount:
return settings.value("nPrivateSendAmount");
case ShowMasternodesTab:
return settings.value("fShowMasternodesTab");
case PrivateSendMultiSession:
Expand Down Expand Up @@ -394,12 +394,12 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
Q_EMIT privateSendRoundsChanged();
}
break;
case AnonymizeDashAmount:
if (settings.value("nAnonymizeDashAmount") != value)
case PrivateSendAmount:
if (settings.value("nPrivateSendAmount") != value)
{
nAnonymizeDashAmount = value.toInt();
settings.setValue("nAnonymizeDashAmount", nAnonymizeDashAmount);
Q_EMIT anonymizeDashAmountChanged();
nPrivateSendAmount = value.toInt();
settings.setValue("nPrivateSendAmount", nPrivateSendAmount);
Q_EMIT privateSentAmountChanged();
}
break;
case ShowMasternodesTab:
Expand Down
4 changes: 2 additions & 2 deletions src/qt/optionsmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class OptionsModel : public QAbstractListModel
SpendZeroConfChange, // bool
ShowAdvancedPSUI, // bool
PrivateSendRounds, // int
AnonymizeDashAmount, // int
PrivateSendAmount, // int
ShowMasternodesTab, // bool
PrivateSendMultiSession,// bool
Listen, // bool
Expand Down Expand Up @@ -97,7 +97,7 @@ class OptionsModel : public QAbstractListModel
Q_SIGNALS:
void displayUnitChanged(int unit);
void privateSendRoundsChanged();
void anonymizeDashAmountChanged();
void privateSentAmountChanged();
void advancedPSUIChanged(bool);
void coinControlFeaturesChanged(bool);
};
Expand Down
22 changes: 11 additions & 11 deletions src/qt/overviewpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ void OverviewPage::setWalletModel(WalletModel *model)

connect(model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit()));
connect(model->getOptionsModel(), SIGNAL(privateSendRoundsChanged()), this, SLOT(updatePrivateSendProgress()));
connect(model->getOptionsModel(), SIGNAL(anonymizeDashAmountChanged()), this, SLOT(updatePrivateSendProgress()));
connect(model->getOptionsModel(), SIGNAL(privateSentAmountChanged()), this, SLOT(updatePrivateSendProgress()));
connect(model->getOptionsModel(), SIGNAL(advancedPSUIChanged(bool)), this, SLOT(updateAdvancedPSUI(bool)));
// explicitly update PS frame and transaction list to reflect actual settings
updateAdvancedPSUI(model->getOptionsModel()->getShowAdvancedPSUI());
Expand Down Expand Up @@ -327,16 +327,16 @@ void OverviewPage::updatePrivateSendProgress()
if(!pwalletMain) return;

QString strAmountAndRounds;
QString strAnonymizeDashAmount = BitcoinUnits::formatHtmlWithUnit(nDisplayUnit, nAnonymizeDashAmount * COIN, false, BitcoinUnits::separatorAlways);
QString strPrivateSendAmount = BitcoinUnits::formatHtmlWithUnit(nDisplayUnit, nPrivateSendAmount * COIN, false, BitcoinUnits::separatorAlways);

if(currentBalance == 0)
{
ui->privateSendProgress->setValue(0);
ui->privateSendProgress->setToolTip(tr("No inputs detected"));

// when balance is zero just show info from settings
strAnonymizeDashAmount = strAnonymizeDashAmount.remove(strAnonymizeDashAmount.indexOf("."), BitcoinUnits::decimals(nDisplayUnit) + 1);
strAmountAndRounds = strAnonymizeDashAmount + " / " + tr("%n Rounds", "", nPrivateSendRounds);
strPrivateSendAmount = strPrivateSendAmount.remove(strPrivateSendAmount.indexOf("."), BitcoinUnits::decimals(nDisplayUnit) + 1);
strAmountAndRounds = strPrivateSendAmount + " / " + tr("%n Rounds", "", nPrivateSendRounds);

ui->labelAmountRounds->setToolTip(tr("No inputs detected"));
ui->labelAmountRounds->setText(strAmountAndRounds);
Expand All @@ -360,20 +360,20 @@ void OverviewPage::updatePrivateSendProgress()
CAmount nMaxToAnonymize = nAnonymizableBalance + currentAnonymizedBalance + nDenominatedUnconfirmedBalance;

// If it's more than the anon threshold, limit to that.
if(nMaxToAnonymize > nAnonymizeDashAmount*COIN) nMaxToAnonymize = nAnonymizeDashAmount*COIN;
if(nMaxToAnonymize > nPrivateSendAmount*COIN) nMaxToAnonymize = nPrivateSendAmount*COIN;

if(nMaxToAnonymize == 0) return;

if(nMaxToAnonymize >= nAnonymizeDashAmount * COIN) {
if(nMaxToAnonymize >= nPrivateSendAmount * COIN) {
ui->labelAmountRounds->setToolTip(tr("Found enough compatible inputs to anonymize %1")
.arg(strAnonymizeDashAmount));
strAnonymizeDashAmount = strAnonymizeDashAmount.remove(strAnonymizeDashAmount.indexOf("."), BitcoinUnits::decimals(nDisplayUnit) + 1);
strAmountAndRounds = strAnonymizeDashAmount + " / " + tr("%n Rounds", "", nPrivateSendRounds);
.arg(strPrivateSendAmount));
strPrivateSendAmount = strPrivateSendAmount.remove(strPrivateSendAmount.indexOf("."), BitcoinUnits::decimals(nDisplayUnit) + 1);
strAmountAndRounds = strPrivateSendAmount + " / " + tr("%n Rounds", "", nPrivateSendRounds);
} else {
QString strMaxToAnonymize = BitcoinUnits::formatHtmlWithUnit(nDisplayUnit, nMaxToAnonymize, false, BitcoinUnits::separatorAlways);
ui->labelAmountRounds->setToolTip(tr("Not enough compatible inputs to anonymize <span style='color:red;'>%1</span>,<br>"
"will anonymize <span style='color:red;'>%2</span> instead")
.arg(strAnonymizeDashAmount)
.arg(strPrivateSendAmount)
.arg(strMaxToAnonymize));
strMaxToAnonymize = strMaxToAnonymize.remove(strMaxToAnonymize.indexOf("."), BitcoinUnits::decimals(nDisplayUnit) + 1);
strAmountAndRounds = "<span style='color:red;'>" +
Expand Down Expand Up @@ -616,7 +616,7 @@ void OverviewPage::togglePrivateSend(){

/* show darksend configuration if client has defaults set */

if(nAnonymizeDashAmount == 0){
if(nPrivateSendAmount == 0){
DarksendConfig dlg(this);
dlg.setModel(walletModel);
dlg.exec();
Expand Down
2 changes: 1 addition & 1 deletion src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ bool fLiteMode = false;
bool fEnableInstantSend = true;
int nInstantSendDepth = 5;
int nPrivateSendRounds = 2;
int nAnonymizeDashAmount = 1000;
int nPrivateSendAmount = 1000;
int nLiquidityProvider = 0;
/**
nWalletBackups:
Expand Down
2 changes: 1 addition & 1 deletion src/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ extern bool fLiteMode;
extern bool fEnableInstantSend;
extern int nInstantSendDepth;
extern int nPrivateSendRounds;
extern int nAnonymizeDashAmount;
extern int nPrivateSendAmount;
extern int nLiquidityProvider;
extern int nWalletBackups;
extern bool fEnablePrivateSend;
Expand Down
2 changes: 1 addition & 1 deletion src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1994,7 +1994,7 @@ CAmount CWallet::GetNeedsToBeAnonymizedBalance(CAmount nMinBalance) const
if(fLiteMode) return 0;

CAmount nAnonymizedBalance = GetAnonymizedBalance();
CAmount nNeedsToAnonymizeBalance = nAnonymizeDashAmount*COIN - nAnonymizedBalance;
CAmount nNeedsToAnonymizeBalance = nPrivateSendAmount*COIN - nAnonymizedBalance;

// try to overshoot target DS balance up to nMinBalance
nNeedsToAnonymizeBalance += nMinBalance;
Expand Down

0 comments on commit 0c65a9c

Please sign in to comment.