Skip to content

Commit e62958d

Browse files
committed
GUI: sendCoinsDialog, remove duplicate wallet().getBalances() call
Inside setModel, we call 'wallet().getBalances()', to set the view balance, right before calling 'updateDisplayUnit' which calls 'wallet().getBalances()' internally and re-sets the view balance again.
1 parent a8098f2 commit e62958d

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/qt/sendcoinsdialog.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,9 @@ void SendCoinsDialog::setModel(WalletModel *_model)
164164
}
165165
}
166166

167-
interfaces::WalletBalances balances = _model->wallet().getBalances();
168-
setBalance(balances);
169167
connect(_model, &WalletModel::balanceChanged, this, &SendCoinsDialog::setBalance);
170-
connect(_model->getOptionsModel(), &OptionsModel::displayUnitChanged, this, &SendCoinsDialog::updateDisplayUnit);
171-
updateDisplayUnit();
168+
connect(_model->getOptionsModel(), &OptionsModel::displayUnitChanged, this, &SendCoinsDialog::refreshBalance);
169+
refreshBalance();
172170

173171
// Coin Control
174172
connect(_model->getOptionsModel(), &OptionsModel::displayUnitChanged, this, &SendCoinsDialog::coinControlUpdateLabels);
@@ -718,7 +716,7 @@ void SendCoinsDialog::setBalance(const interfaces::WalletBalances& balances)
718716
}
719717
}
720718

721-
void SendCoinsDialog::updateDisplayUnit()
719+
void SendCoinsDialog::refreshBalance()
722720
{
723721
setBalance(model->wallet().getBalances());
724722
ui->customFee->setDisplayUnit(model->getOptionsModel()->getDisplayUnit());

src/qt/sendcoinsdialog.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ private Q_SLOTS:
9797
void on_buttonMinimizeFee_clicked();
9898
void removeEntry(SendCoinsEntry* entry);
9999
void useAvailableBalance(SendCoinsEntry* entry);
100-
void updateDisplayUnit();
100+
void refreshBalance();
101101
void coinControlFeatureChanged(bool);
102102
void coinControlButtonClicked();
103103
void coinControlChangeChecked(int);

0 commit comments

Comments
 (0)