Skip to content

Commit 65bdcba

Browse files
committed
[SQUASH] GUI: enable custom operator payout
1 parent fb620ff commit 65bdcba

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/qt/pivx/masternodewizarddialog.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include "qt/pivx/qtutils.h"
1313
#include "qt/walletmodel.h"
1414

15-
#include <QIntValidator>
15+
#include <QDoubleValidator>
1616
#include <QRegularExpression>
1717
#include <QGraphicsDropShadowEffect>
1818

@@ -176,7 +176,7 @@ void MasterNodeWizardDialog::initOperatorPage()
176176
initCssEditLine(ui->lineEditOperatorKey);
177177
initCssEditLine(ui->lineEditOperatorPayoutAddress);
178178
initCssEditLine(ui->lineEditPercentage);
179-
ui->lineEditPercentage->setValidator(new QIntValidator(1, 99));
179+
ui->lineEditPercentage->setValidator(new QDoubleValidator(0.00, 100.00, 2, ui->lineEditPercentage));
180180
}
181181

182182
void MasterNodeWizardDialog::initVoterPage()
@@ -454,7 +454,7 @@ bool MasterNodeWizardDialog::createMN()
454454
// 3) Get operator data
455455
QString operatorKey = ui->lineEditOperatorKey->text();
456456
Optional<CKeyID> operatorPayoutKeyId = walletModel->getKeyIDFromAddr(ui->lineEditOperatorPayoutAddress->text().toStdString());
457-
int operatorPercentage = ui->lineEditPercentage->text().isEmpty() ? 0 : (int) ui->lineEditPercentage->text().toUInt();
457+
double operatorPercentage = ui->lineEditPercentage->text().isEmpty() ? 0 : (int) ui->lineEditPercentage->text().toDouble();
458458

459459
// 4) Get voter data
460460
Optional<CKeyID> votingAddr;
@@ -481,7 +481,7 @@ bool MasterNodeWizardDialog::createMN()
481481
votingAddr,
482482
payoutKeyId,
483483
error_str,
484-
operatorPercentage, // operator percentage
484+
(uint16_t) operatorPercentage * 10000, // operator percentage
485485
operatorPayoutKeyId); // operator payout script
486486
if (!res) {
487487
return errorOut(tr(error_str.c_str()));

src/qt/pivx/mnmodel.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ static CallResult<uint256> createDMNInternal(const COutPoint& collateral,
314314
const Optional<CKeyID>& votingAddr,
315315
const CKeyID& payoutAddr,
316316
const Optional<CBLSSecretKey>& operatorSk,
317-
const Optional<int>& operatorPercentage,
317+
const Optional<uint16_t>& operatorPercentage,
318318
const Optional<CKeyID>& operatorPayoutAddr)
319319
{
320320
ProRegPL pl;
@@ -362,7 +362,7 @@ CallResult<uint256> MNModel::createDMN(const std::string& alias,
362362
const Optional<CKeyID>& votingAddr,
363363
const CKeyID& payoutKeyId,
364364
std::string& strError,
365-
const Optional<int>& operatorPercentage,
365+
const Optional<uint16_t>& operatorPercentage,
366366
const Optional<CKeyID>& operatorPayoutAddr)
367367
{
368368
// Parse and validate inputs

src/qt/pivx/mnmodel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ class MNModel : public QAbstractTableModel
116116
const Optional<CKeyID>& votingAddr,
117117
const CKeyID& payoutAddr,
118118
std::string& strError,
119-
const Optional<int>& operatorPercentage = nullopt,
119+
const Optional<uint16_t>& operatorPercentage = nullopt,
120120
const Optional<CKeyID>& operatorPayoutAddr = nullopt);
121121

122122
// Completely stops the Masternode spending the collateral

0 commit comments

Comments
 (0)