Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show watchonly balance only for Legacy wallets #653

Merged
merged 1 commit into from
Feb 3, 2023

Conversation

achow101
Copy link
Member

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"

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.
@jarolrod jarolrod added the UX All about "how to get things done" label Aug 14, 2022
@hebasto hebasto changed the title gui: Show watchonly balance only for Legacy wallets Show watchonly balance only for Legacy wallets Aug 15, 2022
@hebasto hebasto added the Wallet label Aug 15, 2022
@luke-jr
Copy link
Member

luke-jr commented Aug 19, 2022

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

@luke-jr
Copy link
Member

luke-jr commented Sep 4, 2022

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));

Copy link
Contributor

@hernanmarino hernanmarino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK.

This might be slightly off-topic, but shouldn't the whole "Receive" dialog be disabled when the wallet is unable to generate addresses ? Currently, only the receive button is disabled.

Copy link
Contributor

@pablomartin4btc pablomartin4btc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested ACK (using signet).

Reproduced the issue (watchonly descritor wallets with a balance show watch-only balance 0 on the Send window):

image

image

I've verified that it has been fixed with this change (now it shows balance with the total amount on the Send window matching the one shown on the overview window):

image

Checked also on a descriptor watch-only blank wallet and using importdescriptors function to have some balance within.

As @luke-jr, we could be still showing "watch-only balance" for watch-only descriptor wallets with the balance amount as shown in the overview window instead of the current solution, reafirming that we are on a watch-only wallet.

On @hernanmarino's comment, I think it makes sense to grey out the Receive button when the wallets can't generate addresses avoiding displaying the whole thing:

image

Copy link
Contributor

@johnny9 johnny9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK fdb8dc8

Tested on signet by creating a no-private-key descriptor wallet and then using the importdescriptor command to add an address with funds on it.

on master (65de8ee):
Send dialog shows invalid watch-only balance

Screenshot from 2022-12-31 20-15-03

PR (fdb8dc8):
Send dialog shows correct balance

Screenshot from 2022-12-31 20-38-22

@DrahtBot
Copy link
Contributor

DrahtBot commented Jan 1, 2023

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK johnny9, furszy, hebasto
Concept ACK hernanmarino, pablomartin4btc

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Copy link
Contributor

@pablomartin4btc pablomartin4btc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@achow101 are you planning to move ahead with this? any stoppers?

@achow101
Copy link
Member Author

achow101 commented Feb 1, 2023

@achow101 are you planning to move ahead with this? any stoppers?

Just waiting for reviewers.

Copy link
Member

@furszy furszy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK fdb8dc8

Inlines the balance presented in the send screen with the balance presented in the overview screen.

Not for this PR but would be good to have a visual distinction between wallets with private keys enabled vs wallets without private keys enabled (The previous "watch-only" wording wasn't that bad to fulfill the purpose).

Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK fdb8dc8

Comments about further UX improving could be addressed in follow ups.

@hebasto hebasto merged commit 2ccd7be into bitcoin-core:master Feb 3, 2023
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Feb 3, 2023
…llets

fdb8dc8 gui: Show watchonly balance only for Legacy wallets (Andrew Chow)

Pull request description:

  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"

ACKs for top commit:
  johnny9:
    tACK fdb8dc8
  furszy:
    ACK fdb8dc8
  hebasto:
    ACK fdb8dc8

Tree-SHA512: e5c0703a62d25c881c8dadfb9cffd482791f3d437a4ec5ae0088ce1a2069c2455ad6d3ec6c95a4404a3b55fbd727f92694529c35052236951553ca90c4ed31b5
@bitcoin-core bitcoin-core locked and limited conversation to collaborators Feb 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
UX All about "how to get things done" Wallet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants