Skip to content

Commit fa73ae3

Browse files
furszyFuzzbawls
authored andcommitted
[GUI] Masternode creation wizard, creation fail event properly detailing the failure cause in the subsequent error dialog.
Github-Pull: #1211 Rebased-From: fc9946c
1 parent 447265f commit fa73ae3

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

src/qt/pivx/masternodewizarddialog.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -206,21 +206,22 @@ bool MasterNodeWizardDialog::createMN(){
206206

207207
prepareStatus = walletModel->prepareTransaction(currentTransaction);
208208

209+
QString returnMsg = "Unknown error";
209210
// process prepareStatus and on error generate message shown to user
210-
processSendCoinsReturn(prepareStatus,
211+
returnMsg = processSendCoinsReturn(prepareStatus,
211212
BitcoinUnits::formatWithUnit(walletModel->getOptionsModel()->getDisplayUnit(),
212213
currentTransaction.getTransactionFee()),
213214
true
214215
);
215216

216217
if (prepareStatus.status != WalletModel::OK) {
217-
returnStr = tr("Prepare master node failed..");
218+
returnStr = tr("Prepare master node failed.\n\n%1\n").arg(returnMsg);
218219
return false;
219220
}
220221

221222
WalletModel::SendCoinsReturn sendStatus = walletModel->sendCoins(currentTransaction);
222223
// process sendStatus and on error generate message shown to user
223-
processSendCoinsReturn(sendStatus);
224+
returnMsg = processSendCoinsReturn(sendStatus);
224225

225226
if (sendStatus.status == WalletModel::OK) {
226227
// now change the conf
@@ -286,7 +287,7 @@ bool MasterNodeWizardDialog::createMN(){
286287
}
287288
}
288289
if (indexOut == -1) {
289-
returnStr = tr("Invalid collaterall output index");
290+
returnStr = tr("Invalid collateral output index");
290291
return false;
291292
}
292293
std::string indexOutStr = std::to_string(indexOut);
@@ -323,6 +324,8 @@ bool MasterNodeWizardDialog::createMN(){
323324
} else{
324325
returnStr = tr("masternode.conf file doesn't exists");
325326
}
327+
} else {
328+
returnStr = tr("Cannot send collateral transaction.\n\n%1").arg(returnMsg);
326329
}
327330
}
328331
return false;
@@ -359,7 +362,7 @@ void MasterNodeWizardDialog::onBackClicked(){
359362
}
360363
}
361364

362-
void MasterNodeWizardDialog::processSendCoinsReturn(const WalletModel::SendCoinsReturn& sendCoinsReturn, const QString& msgArg, bool fPrepare)
365+
QString MasterNodeWizardDialog::processSendCoinsReturn(const WalletModel::SendCoinsReturn& sendCoinsReturn, const QString& msgArg, bool fPrepare)
363366
{
364367
bool fAskForUnlock = false;
365368

@@ -408,7 +411,7 @@ void MasterNodeWizardDialog::processSendCoinsReturn(const WalletModel::SendCoins
408411
// included to prevent a compiler warning.
409412
case WalletModel::OK:
410413
default:
411-
return;
414+
return msgParams.first;
412415
}
413416

414417
// Unlock wallet if it wasn't fully unlocked already
@@ -419,11 +422,11 @@ void MasterNodeWizardDialog::processSendCoinsReturn(const WalletModel::SendCoins
419422
}
420423
else {
421424
// Wallet unlocked
422-
return;
425+
return msgParams.first;
423426
}
424427
}
425428

426-
inform(msgParams.first);
429+
return msgParams.first;
427430
}
428431

429432
void MasterNodeWizardDialog::inform(QString text){

src/qt/pivx/masternodewizarddialog.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ private slots:
4646
// Process WalletModel::SendCoinsReturn and generate a pair consisting
4747
// of a message and message flags for use in emit message().
4848
// Additional parameter msgArg can be used via .arg(msgArg).
49-
void processSendCoinsReturn(const WalletModel::SendCoinsReturn& sendCoinsReturn, const QString& msgArg = QString(), bool fPrepare = false);
49+
QString processSendCoinsReturn(const WalletModel::SendCoinsReturn& sendCoinsReturn, const QString& msgArg = QString(), bool fPrepare = false);
5050
void inform(QString text);
5151
void initBtn(std::initializer_list<QPushButton*> args);
5252
};

0 commit comments

Comments
 (0)