Skip to content

Commit 8ac28b8

Browse files
committed
Merge bitcoin#2529: [GUI][BugFix] Masternodes screen, fix impossibility to start Masternodes
85b926e [GUI] MasternodesWidget Fix: missing walletModel in mnmodel constructor. (furszy) Pull request description: Fix impossibility to start Masternodes using the GUI. This was introduced by beb1cf6 (curiously enough, no one noticed it up until now..), the `walletModel` is provided to the widget in `loadWalletModel`, so it can't be used in the `MasternodesWidget` constructor to construct the `mnmodel` object. ACKs for top commit: Fuzzbawls: ACK 85b926e random-zebra: nice catch. We need to backport this to the 5.3 branch. utACK 85b926e and merging... Tree-SHA512: 5cbceadd4d1c622ec38608ba48aa96f36c9b25fd707fbd30591ab0a8a3ba0d10509185d5988110b33ae22ac51e1ab78b341dc0a8ba815770a685c9fabb97a5b4
2 parents 57cb997 + 85b926e commit 8ac28b8

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/qt/pivx/masternodeswidget.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ MasterNodesWidget::MasterNodesWidget(PIVXGUI *parent) :
7171
new MNHolder(isLightTheme()),
7272
this
7373
);
74-
mnModel = new MNModel(this, walletModel);
7574

7675
this->setStyleSheet(parent->styleSheet());
7776

@@ -142,6 +141,7 @@ void MasterNodesWidget::hideEvent(QHideEvent *event)
142141
void MasterNodesWidget::loadWalletModel()
143142
{
144143
if (walletModel) {
144+
mnModel = new MNModel(this, walletModel);
145145
ui->listMn->setModel(mnModel);
146146
ui->listMn->setModelColumn(AddressTableModel::Label);
147147
updateListState();
@@ -216,12 +216,12 @@ void MasterNodesWidget::onEditMNClicked()
216216
}
217217
}
218218

219-
void MasterNodesWidget::startAlias(QString strAlias)
219+
void MasterNodesWidget::startAlias(const QString& strAlias)
220220
{
221221
QString strStatusHtml;
222222
strStatusHtml += "Alias: " + strAlias + " ";
223223

224-
for (CMasternodeConfig::CMasternodeEntry mne : masternodeConfig.getEntries()) {
224+
for (const auto& mne : masternodeConfig.getEntries()) {
225225
if (mne.getAlias() == strAlias.toStdString()) {
226226
std::string strError;
227227
strStatusHtml += (!startMN(mne, strError)) ? ("failed to start.\nError: " + QString::fromStdString(strError)) : "successfully started.";
@@ -232,7 +232,7 @@ void MasterNodesWidget::startAlias(QString strAlias)
232232
updateModelAndInform(strStatusHtml);
233233
}
234234

235-
void MasterNodesWidget::updateModelAndInform(QString informText)
235+
void MasterNodesWidget::updateModelAndInform(const QString& informText)
236236
{
237237
mnModel->updateMNList();
238238
inform(informText);
@@ -276,7 +276,7 @@ bool MasterNodesWidget::startAll(QString& failText, bool onlyMissing)
276276
{
277277
int amountOfMnFailed = 0;
278278
int amountOfMnStarted = 0;
279-
for (CMasternodeConfig::CMasternodeEntry mne : masternodeConfig.getEntries()) {
279+
for (const auto& mne : masternodeConfig.getEntries()) {
280280
// Check for missing only
281281
QString mnAlias = QString::fromStdString(mne.getAlias());
282282
if (onlyMissing && !mnModel->isMNInactive(mnAlias)) {

src/qt/pivx/masternodeswidget.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ private Q_SLOTS:
5252
void onDeleteMNClicked();
5353
void onInfoMNClicked();
5454
void updateListState();
55-
void updateModelAndInform(QString informText);
55+
void updateModelAndInform(const QString& informText);
5656

5757
private:
5858
Ui::MasterNodesWidget *ui;
@@ -65,7 +65,7 @@ private Q_SLOTS:
6565
std::atomic<bool> isLoading;
6666

6767
bool checkMNsNetwork();
68-
void startAlias(QString strAlias);
68+
void startAlias(const QString& strAlias);
6969
bool startAll(QString& failedMN, bool onlyMissing);
7070
bool startMN(const CMasternodeConfig::CMasternodeEntry& mne, std::string& strError);
7171
};

0 commit comments

Comments
 (0)