Skip to content

Commit

Permalink
reducing lower limit to 1.5DRK
Browse files Browse the repository at this point in the history
  • Loading branch information
Evan Duffield committed Dec 26, 2014
1 parent 5eb3bcd commit 31ca8ad
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 20 deletions.
11 changes: 6 additions & 5 deletions src/darksend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ||
Expand All @@ -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;
}
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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;
}
Expand Down
28 changes: 14 additions & 14 deletions src/qt/overviewpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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;

Expand Down Expand Up @@ -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){

Expand Down Expand Up @@ -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++;
Expand All @@ -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){
Expand Down
2 changes: 1 addition & 1 deletion src/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand Down

0 comments on commit 31ca8ad

Please sign in to comment.