@@ -148,8 +148,6 @@ OverviewPage::OverviewPage(const PlatformStyle *platformStyle, QWidget *parent)
148148{
149149 ui->setupUi (this );
150150
151- m_balances.balance = -1 ;
152-
153151 // use a SingleColorIcon for the "out of sync warning" icon
154152 QIcon icon = m_platform_style->SingleColorIcon (QStringLiteral (" :/icons/warning" ));
155153 ui->labelTransactionsStatus ->setIcon (icon);
@@ -178,8 +176,9 @@ void OverviewPage::handleTransactionClicked(const QModelIndex &index)
178176void OverviewPage::setPrivacy (bool privacy)
179177{
180178 m_privacy = privacy;
181- if (m_balances.balance != -1 ) {
182- setBalance (m_balances);
179+ const auto & balances = walletModel->getCachedBalance ();
180+ if (balances.balance != -1 ) {
181+ setBalance (balances);
183182 }
184183
185184 ui->listTransactions ->setVisible (!m_privacy);
@@ -198,7 +197,6 @@ OverviewPage::~OverviewPage()
198197void OverviewPage::setBalance (const interfaces::WalletBalances& balances)
199198{
200199 BitcoinUnit unit = walletModel->getOptionsModel ()->getDisplayUnit ();
201- m_balances = balances;
202200 if (walletModel->wallet ().isLegacy ()) {
203201 if (walletModel->wallet ().privateKeysDisabled ()) {
204202 ui->labelBalance ->setText (BitcoinUnits::formatWithPrivacy (unit, balances.watch_only_balance , BitcoinUnits::SeparatorStyle::ALWAYS, m_privacy));
@@ -306,10 +304,10 @@ void OverviewPage::changeEvent(QEvent* e)
306304
307305void OverviewPage::updateDisplayUnit ()
308306{
309- if (walletModel && walletModel->getOptionsModel ())
310- {
311- if (m_balances .balance != -1 ) {
312- setBalance (m_balances );
307+ if (walletModel && walletModel->getOptionsModel ()) {
308+ const auto & balances = walletModel-> getCachedBalance ();
309+ if (balances .balance != -1 ) {
310+ setBalance (balances );
313311 }
314312
315313 // Update txdelegate->unit with the current unit
0 commit comments