If a wallet is in private key disabled mode, the spendable balance is always zero, it does not have to show on GUI. Show the watch-only balance at normal balance column if a wallet is in that mode.

If a wallet is in private key disabled mode, the spendable balance is always zero, it does not have to show on GUI. Show the watch-only balance at normal balance column if a wallet is in that mode.

<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--174a7506f384e20aa4161008e828411d-->
No conflicts as of last run.
183 | @@ -184,13 +184,24 @@ void OverviewPage::setBalance(const interfaces::WalletBalances& balances)
184 | // show/hide watch-only labels
185 | void OverviewPage::updateWatchOnlyLabels(bool showWatchOnly)
nit, since there is one caller only, could remove it and below do
connect(model, &WalletModel::notifyWatchonlyChanged, [this](bool showWatchOnly) {
updateWalletLabels(showWatchOnly, !walletModel->privateKeysDisabled());
});
Concept ACK. Could add before and after shots.
With multiple wallets loaded, it may be weird to have the toggling, maybe disable instead of hiding?
Concept ACK
Nice! Concept ACK
173 | + if (walletModel->privateKeysDisabled()) { 174 | + ui->labelBalance->setText(BitcoinUnits::formatWithUnit(unit, balances.watch_only_balance, false, BitcoinUnits::separatorAlways)); 175 | + ui->labelUnconfirmed->setText(BitcoinUnits::formatWithUnit(unit, balances.unconfirmed_watch_only_balance, false, BitcoinUnits::separatorAlways)); 176 | + ui->labelImmature->setText(BitcoinUnits::formatWithUnit(unit, balances.immature_watch_only_balance, false, BitcoinUnits::separatorAlways)); 177 | + ui->labelTotal->setText(BitcoinUnits::formatWithUnit(unit, balances.watch_only_balance + balances.unconfirmed_watch_only_balance + balances.immature_watch_only_balance, false, BitcoinUnits::separatorAlways)); 178 | + }
code style nit:
} else {
fixed
Testing https://github.com/bitcoin/bitcoin/pull/13966/commits/fe1ff5026bace9b43ac01c14a26ed0dd75ccc6f7 using the following commands (in the Debug window given that we're looking at a GUI change). Screenshots below, will review further shortly.
src/qt/bitcoin-qt --testnet
createwallet "regular-wallet" false
createwallet "watch-only-wallet" true
// import a random testnet address
importaddress "some-address" "random-addr" false false
<img width="872" alt="regular-wallet" src="https://user-images.githubusercontent.com/863730/44956157-0391b700-aef2-11e8-9b57-8ceacb0d60d1.png">
<img width="874" alt="watch-only" src="https://user-images.githubusercontent.com/863730/44956159-068ca780-aef2-11e8-85ac-e04045c26744.png">
Tested ACK fe1ff5026bace9b43ac01c14a26ed0dd75ccc6f7 Works as expected (also tested with multiwallet)
Concept ACK, the distinction between"spendable" and "watch-only" is confusing anyway, and a big source of scams (even if that particular scam is less likely here, though something to be aware of once #13100 is merged).
The concept of watch-only might become less clear in general moving forward. @sipa does this get in the way of the direction you have in mind for the wallet refactor?
@fanquake based on your image, I think some indications that private keys are disabled is probably desired? Otherwise it looks to a long-time user that indeed you own the funds and have the keys locally.
I believe (didn't test) that you still see the eye icon next to transactions to indicate watch-only, but I think a regular icon in the bottom right would be better. We could get rid of the HD icon to keep visual clutter constant.
Update: Now it shows watch-only eye instead of HD/non-HD wallet icon.
214 | @@ -215,7 +215,7 @@ public Q_SLOTS:
215 | @param[in] status current hd enabled status
Nit: missing param comment
tACK 82d6c5a on macOS 10.13.6
Before: <img width="841" alt="before" src="https://user-images.githubusercontent.com/10217/45827242-ecbed300-bced-11e8-9c30-29e32e478f02.png">
After: <img width="841" alt="after" src="https://user-images.githubusercontent.com/10217/45827789-1f1d0000-bcef-11e8-9bc7-72359e07bb2f.png">
1070 | +void BitcoinGUI::setHDStatus(bool privkeyDisabled, int hdEnabled) 1071 | { 1072 | - labelWalletHDStatusIcon->setPixmap(platformStyle->SingleColorIcon(hdEnabled ? ":/icons/hd_enabled" : ":/icons/hd_disabled").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE)); 1073 | - labelWalletHDStatusIcon->setToolTip(hdEnabled ? tr("HD key generation is <b>enabled</b>") : tr("HD key generation is <b>disabled</b>")); 1074 | + labelWalletHDStatusIcon->setPixmap(platformStyle->SingleColorIcon(privkeyDisabled ? ":/icons/eye" : hdEnabled ? ":/icons/hd_enabled" : ":/icons/hd_disabled").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE)); 1075 | + labelWalletHDStatusIcon->setToolTip(privkeyDisabled ? tr("Private key <b>disabled</b>") : hdEnabled ? tr("HD key generation is <b>enabled</b>") : tr("HD key generation is <b>disabled</b>"));
key -> keys?
Tested ACK https://github.com/bitcoin/bitcoin/pull/13966/commits/82d6c5aad330bb06d0c918b4e9304c25ff2bdcc8
As an alternative which I think might be clearer, what about including the eye next to the Balances title like this?

micro-nit: typo in first commit message priveate -> private
Only vaguely related, @gmaxwell suggested that perhaps we want a wallet-wide flag to treat all watchonly stuff as normal ismine. That goes further than this PR (also affects all RPC commands), but since the existence of multiwallet there is little reason for anyone to mix different "levels" of ismine in the same wallet.