Skip to content

Commit

Permalink
Added fuzzballs wallet PIV fix
Browse files Browse the repository at this point in the history
  • Loading branch information
faetos committed Jul 19, 2018
1 parent 13c0ca8 commit b93d5a4
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 32 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Expand Up @@ -2,7 +2,7 @@ dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 0)
define(_CLIENT_VERSION_MINOR, 14)
define(_CLIENT_VERSION_REVISION, 5)
define(_CLIENT_VERSION_REVISION, 6)
define(_CLIENT_VERSION_BUILD, 0)
define(_CLIENT_VERSION_IS_RELEASE, true)
define(_COPYRIGHT_YEAR, 2018)
Expand Down
2 changes: 1 addition & 1 deletion contrib/gitian-descriptors/gitian-aarch64.yml
@@ -1,5 +1,5 @@
---
name: "helium-aarch64-0.14.5"
name: "helium-aarch64-0.14.6"
enable_cache: true
suites:
- "xenial"
Expand Down
2 changes: 1 addition & 1 deletion contrib/gitian-descriptors/gitian-linux.yml
@@ -1,5 +1,5 @@
---
name: "helium-linux-0.14.5"
name: "helium-linux-0.14.6"
enable_cache: true
suites:
- "trusty"
Expand Down
2 changes: 1 addition & 1 deletion contrib/gitian-descriptors/gitian-osx.yml
@@ -1,5 +1,5 @@
---
name: "helium-osx-0.14.5"
name: "helium-osx-0.14.6"
enable_cache: true
suites:
- "trusty"
Expand Down
2 changes: 1 addition & 1 deletion contrib/gitian-descriptors/gitian-win.yml
@@ -1,5 +1,5 @@
---
name: "helium-win-0.14.5"
name: "helium-win-0.14.6"
enable_cache: true
suites:
- "trusty"
Expand Down
73 changes: 46 additions & 27 deletions src/qt/overviewpage.cpp
Expand Up @@ -157,7 +157,7 @@ OverviewPage::OverviewPage(QWidget* parent) : QWidget(parent),
void OverviewPage::handleTransactionClicked(const QModelIndex& index)
{
if (filter)
Q_EMIT transactionClicked(filter->mapToSource(index));
Q_EMIT transactionClicked(filter->mapToSource(index));
}

OverviewPage::~OverviewPage()
Expand Down Expand Up @@ -209,14 +209,19 @@ void OverviewPage::setBalance(const CAmount& balance, const CAmount& unconfirmed
nLockedBalance = pwalletMain->GetLockedCoins();
nWatchOnlyLockedBalance = pwalletMain->GetLockedWatchOnlyBalance();
}

// PIV Balance
CAmount nTotalBalance = balance + unconfirmedBalance + nLockedBalance;
CAmount pivAvailableBalance = balance - immatureBalance;
CAmount nTotalWatchBalance = watchOnlyBalance + watchUnconfBalance + watchImmatureBalance;
CAmount nUnlockedBalance = nTotalBalance - nLockedBalance - nLockedBalance; // increment nLockedBalance twice because it was added to
// nTotalBalance above
CAmount nTotalBalance = balance + unconfirmedBalance;
CAmount pivAvailableBalance = balance - immatureBalance - nLockedBalance;
CAmount nUnlockedBalance = nTotalBalance - nLockedBalance;

// PIV Watch-Only Balance
CAmount nTotalWatchBalance = watchOnlyBalance + watchUnconfBalance;
CAmount nAvailableWatchBalance = watchOnlyBalance - watchImmatureBalance - nWatchOnlyLockedBalance;

// zPIV Balance
CAmount matureZerocoinBalance = zerocoinBalance - unconfirmedZerocoinBalance - immatureZerocoinBalance;

// Percentages
QString szPercentage = "";
QString sPercentage = "";
Expand All @@ -233,7 +238,7 @@ void OverviewPage::setBalance(const CAmount& balance, const CAmount& unconfirmed
ui->labelTotal->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, nTotalBalance, false, BitcoinUnits::separatorAlways));

// Watchonly labels
ui->labelWatchAvailable->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, watchOnlyBalance, false, BitcoinUnits::separatorAlways));
ui->labelWatchAvailable->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, nAvailableWatchBalance, false, BitcoinUnits::separatorAlways));
ui->labelWatchPending->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, watchUnconfBalance, false, BitcoinUnits::separatorAlways));
ui->labelWatchImmature->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, watchImmatureBalance, false, BitcoinUnits::separatorAlways));
ui->labelWatchLocked->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, nWatchOnlyLockedBalance, false, BitcoinUnits::separatorAlways));
Expand All @@ -254,44 +259,56 @@ void OverviewPage::setBalance(const CAmount& balance, const CAmount& unconfirmed
ui->labelzPIVPercent->setText(szPercentage);

// Adjust bubble-help according to AutoMint settings
QString automintHelp = tr("Current percentage of zHLM.\nIf AutoMint is enabled this percentage will settle around the configured AutoMint percentage (default = 10%).\n");
QString automintHelp = tr("Current percentage of zPIV.\nIf AutoMint is enabled this percentage will settle around the configured AutoMint percentage (default = 10%).\n");
bool fEnableZeromint = GetBoolArg("-enablezeromint", true);
int nZeromintPercentage = GetArg("-zeromintpercentage", 10);
if (fEnableZeromint) {
automintHelp += tr("AutoMint is currently enabled and set to ") + QString::number(nZeromintPercentage) + "%.\n";
automintHelp += tr("To disable AutoMint add 'enablezeromint=0' in helium.conf.");
automintHelp += tr("To disable AutoMint add 'enablezeromint=0' in pivx.conf.");
}
else {
automintHelp += tr("AutoMint is currently disabled.\nTo enable AutoMint change 'enablezeromint=0' to 'enablezeromint=1' in helium.conf");
automintHelp += tr("AutoMint is currently disabled.\nTo enable AutoMint change 'enablezeromint=0' to 'enablezeromint=1' in pivx.conf");
}

// Only show most balances if they are non-zero for the sake of simplicity
QSettings settings;
bool settingShowAllBalances = !settings.value("fHideZeroBalances").toBool();

bool showSumAvailable = settingShowAllBalances || sumTotalBalance != availableTotalBalance;
ui->labelBalanceTextz->setVisible(showSumAvailable);
ui->labelBalancez->setVisible(showSumAvailable);
bool showPIVAvailable = settingShowAllBalances || pivAvailableBalance != nTotalBalance;
bool showWatchOnlyPIVAvailable = watchOnlyBalance != nTotalWatchBalance;
bool showPIVPending = settingShowAllBalances || unconfirmedBalance != 0;
bool showWatchOnlyPIVPending = watchUnconfBalance != 0;
bool showPIVLocked = settingShowAllBalances || nLockedBalance != 0;
bool showWatchOnlyPIVLocked = nWatchOnlyLockedBalance != 0;
bool showImmature = settingShowAllBalances || immatureBalance != 0;
bool showWatchOnlyImmature = watchImmatureBalance != 0;

bool showWatchOnly = nTotalWatchBalance != 0;
ui->labelBalance->setVisible(showPIVAvailable || showWatchOnlyPIVAvailable);

// PIV Available
bool showPIVAvailable = settingShowAllBalances || pivAvailableBalance != nTotalBalance;
bool showWatchOnlyPIVAvailable = settingShowAllBalances || nAvailableWatchBalance != nTotalWatchBalance;
ui->labelBalanceText->setVisible(showPIVAvailable || showWatchOnlyPIVAvailable);
ui->labelWatchAvailable->setVisible(showPIVAvailable && showWatchOnly);
ui->labelUnconfirmed->setVisible(showPIVPending || showWatchOnlyPIVPending);
ui->labelBalance->setVisible(showPIVAvailable || showWatchOnlyPIVAvailable);
ui->labelWatchAvailable->setVisible(showWatchOnlyPIVAvailable && showWatchOnly);

// PIV Pending
bool showPIVPending = settingShowAllBalances || unconfirmedBalance != 0;
bool showWatchOnlyPIVPending = settingShowAllBalances || watchUnconfBalance != 0;
ui->labelPendingText->setVisible(showPIVPending || showWatchOnlyPIVPending);
ui->labelWatchPending->setVisible(showPIVPending && showWatchOnly);
ui->labelLockedBalance->setVisible(showPIVLocked || showWatchOnlyPIVLocked);
ui->labelUnconfirmed->setVisible(showPIVPending || showWatchOnlyPIVPending);
ui->labelWatchPending->setVisible(showWatchOnlyPIVPending && showWatchOnly);

// PIV Immature
bool showPIVImmature = settingShowAllBalances || immatureBalance != 0;
bool showWatchOnlyImmature = settingShowAllBalances || watchImmatureBalance != 0;
ui->labelImmatureText->setVisible(showPIVImmature || showWatchOnlyImmature);
ui->labelImmature->setVisible(showPIVImmature || showWatchOnlyImmature); // for symmetry reasons also show immature label when the watch-only one is shown
ui->labelWatchImmature->setVisible(showWatchOnlyImmature && showWatchOnly); // show watch-only immature balance

// PIV Locked
bool showPIVLocked = settingShowAllBalances || nLockedBalance != 0;
bool showWatchOnlyPIVLocked = settingShowAllBalances || nWatchOnlyLockedBalance != 0;
ui->labelLockedBalanceText->setVisible(showPIVLocked || showWatchOnlyPIVLocked);
ui->labelWatchLocked->setVisible(showPIVLocked && showWatchOnly);
ui->labelImmature->setVisible(showImmature || showWatchOnlyImmature); // for symmetry reasons also show immature label when the watch-only one is shown
ui->labelImmatureText->setVisible(showImmature || showWatchOnlyImmature);
ui->labelWatchImmature->setVisible(showImmature && showWatchOnly); // show watch-only immature balance
ui->labelLockedBalance->setVisible(showPIVLocked || showWatchOnlyPIVLocked);
ui->labelWatchLocked->setVisible(showWatchOnlyPIVLocked && showWatchOnly);

// zPIV
bool showzPIVAvailable = settingShowAllBalances || zerocoinBalance != matureZerocoinBalance;
bool showzPIVUnconfirmed = settingShowAllBalances || unconfirmedZerocoinBalance != 0;
bool showzPIVImmature = settingShowAllBalances || immatureZerocoinBalance != 0;
Expand All @@ -301,6 +318,8 @@ void OverviewPage::setBalance(const CAmount& balance, const CAmount& unconfirmed
ui->labelzBalanceUnconfirmedText->setVisible(showzPIVUnconfirmed);
ui->labelzBalanceImmature->setVisible(showzPIVImmature);
ui->labelzBalanceImmatureText->setVisible(showzPIVImmature);

// Percent split
bool showPercentages = ! (zerocoinBalance == 0 && nTotalBalance == 0);
ui->labelPIVPercent->setVisible(showPercentages);
ui->labelzPIVPercent->setVisible(showPercentages);
Expand Down

0 comments on commit b93d5a4

Please sign in to comment.