From 745142f6bf03a19ac8709cc34da1131c8ca92a2f Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Fri, 7 Aug 2015 06:19:10 +0300 Subject: [PATCH] DS progress weights depend on DS rounds in settings / force overview to update on OK in options --- src/qt/optionsdialog.cpp | 2 +- src/qt/overviewpage.cpp | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp index 2758afa5b..1d9877e90 100644 --- a/src/qt/optionsdialog.cpp +++ b/src/qt/optionsdialog.cpp @@ -251,7 +251,7 @@ void OptionsDialog::on_resetButton_clicked() void OptionsDialog::on_okButton_clicked() { mapper->submit(); - darkSendPool.cachedNumBlocks = 0; + pwalletMain->MarkDirty(); accept(); } diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index e07270549..688c5cb5d 100644 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -374,17 +374,25 @@ void OverviewPage::updateDarksendProgress() int64_t denominatedBalance = pwalletMain->GetDenominatedBalance() + nDenominatedUnconfirmedBalance; denomPart = (float)denominatedBalance / nMaxToAnonymize; denomPart = denomPart > 1 ? 1 : denomPart; + denomPart *= 100; anonNormPart = (float)pwalletMain->GetNormalizedAnonymizedBalance() / nMaxToAnonymize; anonNormPart = anonNormPart > 1 ? 1 : anonNormPart; + anonNormPart *= 100; anonFullPart = (float)pwalletMain->GetAnonymizedBalance() / nMaxToAnonymize; anonFullPart = anonFullPart > 1 ? 1 : anonFullPart; + anonFullPart *= 100; - // apply some weights to them (sum should be <=100) and calculate the whole progress - float denomPartCalc = ceilf((denomPart * 20) * 100) / 100; - float anonNormPartCalc = ceilf((anonNormPart * 50) * 100) / 100; - float anonFullPartCalc = ceilf((anonFullPart * 30) * 100) / 100; + // apply some weights to them ... + float denomWeight = 1; + float anonNormWeight = nDarksendRounds; + float anonFullWeight = 2; + float fullWeight = denomWeight + anonNormWeight + anonFullWeight; + // ... and calculate the whole progress + float denomPartCalc = ceilf((denomPart * denomWeight / fullWeight) * 100) / 100; + float anonNormPartCalc = ceilf((anonNormPart * anonNormWeight / fullWeight) * 100) / 100; + float anonFullPartCalc = ceilf((anonFullPart * anonFullWeight / fullWeight) * 100) / 100; float progress = denomPartCalc + anonNormPartCalc + anonFullPartCalc; if(progress >= 100) progress = 100; @@ -395,7 +403,7 @@ void OverviewPage::updateDarksendProgress() tr("Mixed") + ": %3%
" + tr("Anonymized") + ": %4%
" + tr("Denominated inputs have %5 of %n rounds on average", "", nDarksendRounds)) - .arg(progress).arg(denomPart * 100).arg(anonNormPart * 100).arg(anonFullPart * 100) + .arg(progress).arg(denomPart).arg(anonNormPart).arg(anonFullPart) .arg(pwalletMain->GetAverageAnonymizedRounds()); ui->darksendProgress->setToolTip(strToolPip); }