prevent unnecessary rounding
This commit is contained in:
@@ -22,7 +22,7 @@
|
|||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab">
|
<widget class="QWidget" name="tab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
@@ -362,6 +362,9 @@
|
|||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
<property name="placeholderText">
|
<property name="placeholderText">
|
||||||
<string>Amount</string>
|
<string>Amount</string>
|
||||||
</property>
|
</property>
|
||||||
|
|||||||
@@ -155,21 +155,15 @@ QList<double> Turnstile::splitAmount(double amount, int parts) {
|
|||||||
// Add the Tx fees
|
// Add the Tx fees
|
||||||
sumofparts += amounts.size() * Utils::getMinerFee();
|
sumofparts += amounts.size() * Utils::getMinerFee();
|
||||||
|
|
||||||
|
qDebug() << QString::number(sumofparts, 'f', 8) << QString::number(amount, 'f', 8);
|
||||||
Q_ASSERT(QString::number(sumofparts, 'f', 8) == QString::number(amount, 'f', 8));
|
Q_ASSERT(QString::number(sumofparts, 'f', 8) == QString::number(amount, 'f', 8));
|
||||||
return amounts;
|
return amounts;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Turnstile::fillAmounts(QList<double>& amounts, double amount, int count) {
|
void Turnstile::fillAmounts(QList<double>& amounts, double amount, int count) {
|
||||||
if (count == 1 || amount < 0.01) {
|
if (count == 1 || amount < 0.01) {
|
||||||
// Split the chaff.
|
|
||||||
// Chaff is all amounts lesser than 0.0001 ZEC. The chaff will be added to the
|
|
||||||
// dev fee, and is done so to protect privacy.
|
|
||||||
|
|
||||||
// Get the rounded value to 4 decimal places (approx $0.01)
|
|
||||||
double actual = std::floor(amount * 10000) / 10000;
|
|
||||||
|
|
||||||
// Also account for the fees needed to send all these transactions
|
// Also account for the fees needed to send all these transactions
|
||||||
actual = actual - (Utils::getMinerFee() * (amounts.size() + 1));
|
auto actual = amount - (Utils::getMinerFee() * (amounts.size() + 1));
|
||||||
|
|
||||||
amounts.push_back(actual);
|
amounts.push_back(actual);
|
||||||
return;
|
return;
|
||||||
@@ -317,6 +311,11 @@ void Turnstile::executeMigrationStep() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!rpc->getAllBalances()->keys().contains(nextStep->intTAddr)) {
|
||||||
|
qDebug() << QString("The int address doesn't have balance, even though it is confirmed");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Send it to the final destination address.
|
// Send it to the final destination address.
|
||||||
auto bal = rpc->getAllBalances()->value(nextStep->intTAddr);
|
auto bal = rpc->getAllBalances()->value(nextStep->intTAddr);
|
||||||
auto sendAmt = bal - Utils::getMinerFee();
|
auto sendAmt = bal - Utils::getMinerFee();
|
||||||
|
|||||||
@@ -409,6 +409,7 @@ public:
|
|||||||
Amount1 = new QLineEdit(verticalGroupBox);
|
Amount1 = new QLineEdit(verticalGroupBox);
|
||||||
Amount1->setObjectName(QStringLiteral("Amount1"));
|
Amount1->setObjectName(QStringLiteral("Amount1"));
|
||||||
Amount1->setBaseSize(QSize(200, 0));
|
Amount1->setBaseSize(QSize(200, 0));
|
||||||
|
Amount1->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
|
||||||
|
|
||||||
horizontalLayout_13->addWidget(Amount1);
|
horizontalLayout_13->addWidget(Amount1);
|
||||||
|
|
||||||
@@ -683,7 +684,7 @@ public:
|
|||||||
|
|
||||||
retranslateUi(MainWindow);
|
retranslateUi(MainWindow);
|
||||||
|
|
||||||
tabWidget->setCurrentIndex(0);
|
tabWidget->setCurrentIndex(1);
|
||||||
|
|
||||||
|
|
||||||
QMetaObject::connectSlotsByName(MainWindow);
|
QMetaObject::connectSlotsByName(MainWindow);
|
||||||
|
|||||||
Reference in New Issue
Block a user