From 31ca8ad5f94ba6943c5116b90f3834a0daa33a16 Mon Sep 17 00:00:00 2001 From: Evan Duffield Date: Thu, 25 Dec 2014 20:58:39 -0700 Subject: [PATCH] reducing lower limit to 1.5DRK --- src/darksend.cpp | 11 ++++++----- src/qt/overviewpage.cpp | 28 ++++++++++++++-------------- src/wallet.cpp | 2 +- 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/src/darksend.cpp b/src/darksend.cpp index 0c548c1f8..570705680 100644 --- a/src/darksend.cpp +++ b/src/darksend.cpp @@ -1421,6 +1421,7 @@ bool CDarkSendPool::DoAutomaticDenominating(bool fDryRun, bool ready) int maxRounds = 2; int maxAmount = DARKSEND_POOL_MAX/COIN; bool hasFeeInput = false; + int64_t lowestDenom = COIN*1; // if we have more denominated funds (of any maturity) than the nAnonymizeDarkcoinAmount, we should use use those if(pwalletMain->GetDenominatedBalance(true) >= nAnonymizeDarkcoinAmount*COIN || @@ -1433,8 +1434,8 @@ bool CDarkSendPool::DoAutomaticDenominating(bool fDryRun, bool ready) int64_t balanceNeedsAnonymized = pwalletMain->GetBalance() - pwalletMain->GetAnonymizedBalance(); if(balanceNeedsAnonymized > maxAmount*COIN) balanceNeedsAnonymized= maxAmount*COIN; - if(balanceNeedsAnonymized < COIN*2.5 || - (vecDisabledDenominations.size() > 0 && balanceNeedsAnonymized < COIN*12.5)){ + if(balanceNeedsAnonymized < lowestDenom || + (vecDisabledDenominations.size() > 0 && balanceNeedsAnonymized < COIN*10)){ LogPrintf("DoAutomaticDenominating : No funds detected in need of denominating \n"); return false; } @@ -1462,8 +1463,8 @@ bool CDarkSendPool::DoAutomaticDenominating(bool fDryRun, bool ready) } // the darksend pool can only take 2.5DRK minimum - if(nValueIn < COIN*2.5 || - (vecDisabledDenominations.size() > 0 && nValueIn < COIN*12.5) + if(nValueIn < lowestDenom || + (vecDisabledDenominations.size() > 0 && nValueIn < COIN*10) ){ //simply look for non-denominated coins if (pwalletMain->SelectCoinsDark(maxAmount*COIN, 9999999*COIN, vCoins, nValueIn, minRounds, maxRounds, hasFeeInput)) @@ -1791,7 +1792,7 @@ bool CDarkSendPool::SplitUpMoney(bool justCollateral) LogPrintf("SplitUpMoney: Not enough outputs to make a transaction\n"); return false; } - if((!justCollateral && nTotalOut <= 1.1*COIN) || vecSend.size() < 1){ + if((!justCollateral && nTotalOut <= 1*COIN) || vecSend.size() < 1){ LogPrintf("SplitUpMoney: Not enough outputs to make a transaction\n"); return false; } diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index 86129fe7a..389e30ddb 100644 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -249,7 +249,7 @@ void OverviewPage::updateDarksendProgress(){ if(balance == 0){ ui->darksendProgress->setValue(0); QString s("No inputs detected"); - ui->darksendProgress->setToolTip(s); + ui->darksendProgress->setToolTip(s); return; } @@ -260,10 +260,10 @@ void OverviewPage::updateDarksendProgress(){ double max = nAnonymizeDarkcoinAmount; //If it's more than the wallet amount, limit to that. if(max > (double)(pwalletMain->GetBalance()/COIN)-1) max = (double)(pwalletMain->GetBalance()/COIN)-1; - //denominated balance / anon threshold -- the percentage that we've completed + //denominated balance / anon threshold -- the percentage that we've completed double b = ((double)(pwalletMain->GetDenominatedBalance()/COIN) / max); - double val = a*b; + double val = a*b; if(val < 0) val = 0; if(val > 100) val = 100; @@ -320,7 +320,7 @@ void OverviewPage::darkSendStatus() LogPrintf("Wallet is locked and user declined to unlock. Disabling Darksend.\n"); } } - if((nAnonymizeDarkcoinAmount*COIN)-pwalletMain->GetAnonymizedBalance() <= 1.1*COIN && + if((nAnonymizeDarkcoinAmount*COIN)-pwalletMain->GetAnonymizedBalance() <= 1.1*COIN && walletModel->getEncryptionStatus() == WalletModel::Unlocked && darkSendPool.GetMyTransactionCount() == 0){ @@ -380,13 +380,13 @@ void OverviewPage::darkSendStatus() convert << "unknown state : id=" << state; } - if(state == POOL_STATUS_ERROR || state == POOL_STATUS_SUCCESS) darkSendPool.Check(); + if(state == POOL_STATUS_ERROR || state == POOL_STATUS_SUCCESS) darkSendPool.Check(); QString s(convert.str().c_str()); if(s != ui->darksendStatus->text()) LogPrintf("%s\n", convert.str().c_str()); - + ui->darksendStatus->setText(s); showingDarkSendMessage++; @@ -400,17 +400,17 @@ void OverviewPage::runDoAutomaticDenomination(){ } void OverviewPage::toggleDarksend(){ - int64_t balance = pwalletMain->GetBalance(); - if(balance < 2.5*COIN){ - QMessageBox::warning(this, tr("Darksend"), - tr("Darksend requires at least 2.5 DRK to use."), - QMessageBox::Ok, QMessageBox::Ok); - return; + if(!fEnableDarksend){ + int64_t balance = pwalletMain->GetBalance(); + if(balance < 1.49*COIN){ + QMessageBox::warning(this, tr("Darksend"), + tr("Darksend requires at least 1.5 DRK to use."), + QMessageBox::Ok, QMessageBox::Ok); + return; + } } - darkSendPool.cachedNumBlocks = 0; - fEnableDarksend = !fEnableDarksend; if(!fEnableDarksend){ diff --git a/src/wallet.cpp b/src/wallet.cpp index 46bbe0b6d..10a476151 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -1416,7 +1416,7 @@ bool CWallet::SelectCoinsDark(int64_t nValueMin, int64_t nValueMax, std::vector< BOOST_FOREACH(const COutput& out, vCoins) { //there's no reason to allow inputs less than 1 COIN into DS (other than denominations smaller than that amount) - if(out.tx->vout[out.i].nValue <= 1*COIN && out.tx->vout[out.i].nValue != (.1*COIN)+1) continue; + if(out.tx->vout[out.i].nValue < 1*COIN && out.tx->vout[out.i].nValue != (.1*COIN)+1) continue; if(fMasterNode && out.tx->vout[out.i].nValue == 1000*COIN) continue; //masternode input if(nValueRet + out.tx->vout[out.i].nValue <= nValueMax){