diff options
author | Samuel Dobson <dobsonsa68@gmail.com> | 2019-11-29 23:15:55 +1300 |
---|---|---|
committer | Samuel Dobson <dobsonsa68@gmail.com> | 2019-11-29 23:16:08 +1300 |
commit | abb30de63f368c9875c3f2a4cfe91b1daf9412da (patch) | |
tree | 05d2960586e42607f16b159363ff4298d4794b48 /src/qt/sendcoinsdialog.cpp | |
parent | 114e89e596a66f3cb1ebd8fc2d775b61c5722245 (diff) | |
parent | 4a96e459d733f1b6427221aaa1874ea00f79988a (diff) |
Merge #17587: gui: show watch-only balance in send screen
4a96e459d733f1b6427221aaa1874ea00f79988a [gui] send: show watch-only balance in send screen (Sjors Provoost)
2689c8fd7159f47248c5fc365463be8b0e8b039c [test] qt: add send screen balance test (Sjors Provoost)
Pull request description:
Now that we can create a PSBT from a watch-only wallet (#16944), we should also display the watch-only balance on the send screen.
Before:
<img width="1008" alt="before" src="https://user-images.githubusercontent.com/10217/69533384-030e9180-0f78-11ea-9748-c32c957e822e.png">
After:
<img width="1009" alt="Schermafbeelding 2019-11-26 om 11 44 17" src="https://user-images.githubusercontent.com/10217/69622879-19811f80-1042-11ea-8279-091012f39b38.png">
I added a test to check the balance on the send screen, but it only covers regular wallets. A better would add a watch-only only wallet.
ACKs for top commit:
meshcollider:
utACK 4a96e459d733f1b6427221aaa1874ea00f79988a
jb55:
utACK 4a96e459d733f1b6427221aaa1874ea00f79988a
promag:
reACK 4a96e45, rebased and label change since last review.
instagibbs:
code review and light test ACK https://github.com/bitcoin/bitcoin/pull/17587/commits/4a96e459d733f1b6427221aaa1874ea00f79988a
Tree-SHA512: 4213549888bd309f72bdbba1453218f4a2b07e809100d786a3791897c75468f9092b06fe4b971942b1c228aa75ee7c04971f262ca9a478b42756e056eb534620
Diffstat (limited to 'src/qt/sendcoinsdialog.cpp')
-rw-r--r-- | src/qt/sendcoinsdialog.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index 9c4c9dbb17..f1ea3e23e5 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -562,7 +562,12 @@ void SendCoinsDialog::setBalance(const interfaces::WalletBalances& balances) { if(model && model->getOptionsModel()) { - ui->labelBalance->setText(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), balances.balance)); + CAmount balance = balances.balance; + if (model->privateKeysDisabled()) { + balance = balances.watch_only_balance; + ui->labelBalanceName->setText(tr("Watch-only balance:")); + } + ui->labelBalance->setText(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), balance)); } } |