Skip to content

Commit fd66231

Browse files
committed
Fix lint
1 parent b8b9593 commit fd66231

3 files changed

Lines changed: 161 additions & 167 deletions

File tree

src/qt/pivx/masternodeswidget.cpp

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -216,41 +216,40 @@ void MasterNodesWidget::onEditMNClicked()
216216
}
217217
} else {
218218
inform(tr(
219-
"Cannot start masternode, the collateral transaction has not been confirmed by the network yet.\n"
220-
"Please wait few more minutes (masternode collaterals require %1 confirmations).").arg(
221-
mnModel->getMasternodeCollateralMinConf()));
219+
"Cannot start masternode, the collateral transaction has not been confirmed by the network yet.\n"
220+
"Please wait few more minutes (masternode collaterals require %1 confirmations).")
221+
.arg(
222+
mnModel->getMasternodeCollateralMinConf()));
222223
}
223224
} else {
224225
// Deterministic
225226
bool isEnabled = index.sibling(index.row(), MNModel::IS_POSE_ENABLED).data(Qt::DisplayRole).toBool();
226227
if (isEnabled) {
227228
inform(tr("Cannot start an already started Masternode"));
228-
}else{
229-
uint256 proTxHash =uint256S(index.sibling(index.row(), MNModel::PRO_TX_HASH).data(Qt::DisplayRole).toString().toStdString());
229+
} else {
230+
uint256 proTxHash = uint256S(index.sibling(index.row(), MNModel::PRO_TX_HASH).data(Qt::DisplayRole).toString().toStdString());
230231
Optional<DMNData> opDMN = interfaces::g_tiertwo->getDMNData(proTxHash,
231-
clientModel->getLastBlockIndexProcessed());
232-
if(!opDMN){
232+
clientModel->getLastBlockIndexProcessed());
233+
if (!opDMN) {
233234
inform(tr("Masternode not found"));
234-
}else{
235+
} else {
235236
std::string operatorKeyS = opDMN->operatorSk;
236-
if(operatorKeyS.empty()){
237+
if (operatorKeyS.empty()) {
237238
inform("Operator secret key not found");
238-
}else{
239-
Optional<CBLSSecretKey> operator_key = bls::DecodeSecret(Params(),operatorKeyS);
240-
if(operator_key){
239+
} else {
240+
Optional<CBLSSecretKey> operator_key = bls::DecodeSecret(Params(), operatorKeyS);
241+
if (operator_key) {
241242
std::string error_str = "";
242-
if(!mnModel->unbanDMN(*operator_key,proTxHash,error_str)){
243+
if (!mnModel->unbanDMN(*operator_key, proTxHash, error_str)) {
243244
inform(QString::fromStdString(error_str));
244-
}else{
245+
} else {
245246
inform("Masternode successfully unbanned! Wait for the next minted block and it will update");
246247
}
247-
}else{
248+
} else {
248249
inform("Could not decode operator secret key");
249250
}
250251
}
251-
252252
}
253-
254253
}
255254
}
256255
}

src/qt/pivx/masternodewizarddialog.cpp

Lines changed: 38 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

55
#include "qt/pivx/masternodewizarddialog.h"
6-
#include "optional.h"
7-
#include "primitives/transaction.h"
86
#include "qt/pivx/forms/ui_masternodewizarddialog.h"
97

108
#include "key_io.h"
@@ -418,12 +416,12 @@ bool MasterNodeWizardDialog::createMN()
418416
auto r = walletModel->getNewAddress(alias);
419417
if (!r) return errorOut(tr(r.getError().c_str()));
420418
if (!mnModel->createMNCollateral(addressLabel,
421-
QString::fromStdString(r.getObjResult()->ToString()),
422-
collateralOut,
423-
returnStr)) {
424-
// error str set internally
425-
return false;
426-
}
419+
QString::fromStdString(r.getObjResult()->ToString()),
420+
collateralOut,
421+
returnStr)) {
422+
// error str set internally
423+
return false;
424+
}
427425
}
428426

429427
if (isDeterministic) {
@@ -447,7 +445,7 @@ bool MasterNodeWizardDialog::createMN()
447445
// 3) Get operator data
448446
QString operatorKey = ui->lineEditOperatorKey->text();
449447
Optional<CKeyID> operatorPayoutKeyId = walletModel->getKeyIDFromAddr(ui->lineEditOperatorPayoutAddress->text().toStdString());
450-
double operatorPercentage = ui->lineEditPercentage->text().isEmpty() ? 0 : (double) ui->lineEditPercentage->text().toDouble();
448+
double operatorPercentage = ui->lineEditPercentage->text().isEmpty() ? 0 : (double)ui->lineEditPercentage->text().toDouble();
451449

452450
// 4) Get voter data
453451
Optional<CKeyID> votingAddr;
@@ -463,32 +461,32 @@ bool MasterNodeWizardDialog::createMN()
463461
votingAddr = ownerKeyId;
464462
}
465463

466-
Optional<COutPoint> collateralOut = COutPoint();
464+
Optional<COutPoint> collateralOut = COutPoint();
467465
bool foundCandidate = false;
468-
if(!walletModel->getMNCollateralCandidate(*collateralOut)){
469-
collateralOut= nullopt;
470-
}else{
471-
//We have to lock the collateral or the system could spend it
466+
if (!walletModel->getMNCollateralCandidate(*collateralOut)) {
467+
collateralOut = nullopt;
468+
} else {
469+
// We have to lock the collateral or the system could spend it
472470
walletModel->lockCoin(*collateralOut);
473471
foundCandidate = true;
474472
}
475473
std::string error_str;
476-
474+
477475
auto res = mnModel->createDMN(alias,
478-
collateralOut,
479-
addressLabel,
480-
ipAddress,
481-
port,
482-
ownerKeyId,
483-
operatorKey.isEmpty() ? nullopt : Optional<std::string>(operatorKey.toStdString()),
484-
votingAddr,
485-
payoutKeyId,
486-
error_str,
487-
(uint16_t) operatorPercentage * 100, // operator percentage
488-
operatorPayoutKeyId); // operator payout script
476+
collateralOut,
477+
addressLabel,
478+
ipAddress,
479+
port,
480+
ownerKeyId,
481+
operatorKey.isEmpty() ? nullopt : Optional<std::string>(operatorKey.toStdString()),
482+
votingAddr,
483+
payoutKeyId,
484+
error_str,
485+
(uint16_t)operatorPercentage * 100, // operator percentage
486+
operatorPayoutKeyId); // operator payout script
489487
if (!res) {
490-
//unlock in case of error
491-
if(foundCandidate){
488+
// unlock in case of error
489+
if (foundCandidate) {
492490
walletModel->unlockCoin(*collateralOut);
493491
}
494492
return errorOut(tr(error_str.c_str()));
@@ -497,18 +495,17 @@ bool MasterNodeWizardDialog::createMN()
497495
// future: move "operatorSk" to a constant field
498496
std::string operatorSk = walletModel->getStrFromTxExtraData(*res.getObjResult(), "operatorSk");
499497
mnSummary = std::make_unique<MNSummary>(alias,
500-
ipAddress+":"+port,
501-
collateralOut?*collateralOut:COutPoint(UINT256_ZERO,0), //TODO: the outpoint index is not 0 in general, but it does not matter (just display)
502-
ownerAddrStr,
503-
payoutAddrStr,
504-
operatorSk.empty() ? operatorKey.toStdString() : operatorSk,
505-
ownerAddrStr, // voting key, for now fixed to owner addr
506-
0, // operator percentage
507-
nullopt); // operator payout
498+
ipAddress + ":" + port,
499+
collateralOut ? *collateralOut : COutPoint(UINT256_ZERO, 0), // TODO: the outpoint index is not 0 in general, but it does not matter (just display)
500+
ownerAddrStr,
501+
payoutAddrStr,
502+
operatorSk.empty() ? operatorKey.toStdString() : operatorSk,
503+
ownerAddrStr, // voting key, for now fixed to owner addr
504+
0, // operator percentage
505+
nullopt); // operator payout
508506

509507
returnStr = tr("Deterministic Masternode created! It will appear on your list on the next mined block!");
510508
} else {
511-
512509
// Legacy
513510
// Look for a valid collateral utxo
514511
COutPoint collateralOut;
@@ -517,10 +514,10 @@ bool MasterNodeWizardDialog::createMN()
517514
// New receive address
518515
auto r = walletModel->getNewAddress(alias);
519516
if (!r) return errorOut(tr(r.getError().c_str()));
520-
if (!mnModel->createDMNExternalCollateral(addressLabel,
521-
QString::fromStdString(r.getObjResult()->ToString()),
522-
collateralOut,
523-
returnStr)) {
517+
if (!mnModel->createDMNExternalCollateral(addressLabel,
518+
QString::fromStdString(r.getObjResult()->ToString()),
519+
collateralOut,
520+
returnStr)) {
524521
// error str set internally
525522
return false;
526523
}

0 commit comments

Comments
 (0)