gui icon indicating copy to clipboard operation
gui copied to clipboard

Show watchonly balance only for Legacy wallets

Open achow101 opened this issue 3 years ago • 2 comments

Descriptor wallets do not have a watchonly balance as wallets are designated watchonly or not. Thus we should not be displaying the empty watchonly balance for descriptor wallets.

The result is that instead of the send page showing "Watch-only balance: 0.00000000 BTC" for watchonly descriptor wallets, we see the actual balance as "Balance: 10.00000000 BTC"

achow101 avatar Aug 14 '22 20:08 achow101

Hmm, maybe we should hide the "Balance" for watch-only descriptor wallets, and show the right thing as watch-only?

luke-jr avatar Aug 19 '22 01:08 luke-jr

eg

--- a/src/qt/sendcoinsdialog.cpp
+++ b/src/qt/sendcoinsdialog.cpp
@@ -702,7 +702,9 @@ void SendCoinsDialog::setBalance(const interfaces::WalletBalances& balances)
         if (model->wallet().hasExternalSigner()) {
             ui->labelBalanceName->setText(tr("External balance:"));
         } else if (model->wallet().privateKeysDisabled()) {
-            balance = balances.watch_only_balance;
+            if (model->wallet().isLegacy()) {
+                balance = balances.watch_only_balance;
+            }
             ui->labelBalanceName->setText(tr("Watch-only balance:"));
         }
         ui->labelBalance->setText(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), balance));

luke-jr avatar Sep 04 '22 00:09 luke-jr