@@ -148,8 +148,6 @@ OverviewPage::OverviewPage(const PlatformStyle *platformStyle, QWidget *parent)
148
148
{
149
149
ui->setupUi (this );
150
150
151
- m_balances.balance = -1 ;
152
-
153
151
// use a SingleColorIcon for the "out of sync warning" icon
154
152
QIcon icon = m_platform_style->SingleColorIcon (QStringLiteral (" :/icons/warning" ));
155
153
ui->labelTransactionsStatus ->setIcon (icon);
@@ -178,8 +176,9 @@ void OverviewPage::handleTransactionClicked(const QModelIndex &index)
178
176
void OverviewPage::setPrivacy (bool privacy)
179
177
{
180
178
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);
183
182
}
184
183
185
184
ui->listTransactions ->setVisible (!m_privacy);
@@ -198,7 +197,6 @@ OverviewPage::~OverviewPage()
198
197
void OverviewPage::setBalance (const interfaces::WalletBalances& balances)
199
198
{
200
199
BitcoinUnit unit = walletModel->getOptionsModel ()->getDisplayUnit ();
201
- m_balances = balances;
202
200
if (walletModel->wallet ().isLegacy ()) {
203
201
if (walletModel->wallet ().privateKeysDisabled ()) {
204
202
ui->labelBalance ->setText (BitcoinUnits::formatWithPrivacy (unit, balances.watch_only_balance , BitcoinUnits::SeparatorStyle::ALWAYS, m_privacy));
@@ -306,10 +304,10 @@ void OverviewPage::changeEvent(QEvent* e)
306
304
307
305
void OverviewPage::updateDisplayUnit ()
308
306
{
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 );
313
311
}
314
312
315
313
// Update txdelegate->unit with the current unit
0 commit comments