From 17eb7be81cc63484ee1a49883421259e7838e68c Mon Sep 17 00:00:00 2001 From: Aditya Kulkarni Date: Mon, 29 Oct 2018 09:48:23 -0700 Subject: [PATCH] Remove debug warnings from screen --- src/mainwindow.cpp | 14 +++++++------- src/turnstile.cpp | 26 +++++++++++++------------- src/turnstile.h | 6 ++++-- 3 files changed, 24 insertions(+), 22 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 633aa73..fba7d67 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -8,7 +8,7 @@ #include "balancestablemodel.h" #include "settings.h" #include "utils.h" -#import "turnstile.h" +#include "turnstile.h" #include "senttxstore.h" #include "precompiled.h" @@ -198,9 +198,9 @@ void MainWindow::turnstileDoMigration() { // Privacy level combobox // Num tx over num blocks QList> privOptions; - privOptions.push_back(QPair(3, 3)); - privOptions.push_back(QPair(5, 5)); - privOptions.push_back(QPair(10, 7)); + privOptions.push_back(QPair(3, 6)); + privOptions.push_back(QPair(5, 10)); + privOptions.push_back(QPair(10, 20)); QObject::connect(turnstile.privLevel, QOverload::of(&QComboBox::currentIndexChanged), [=] (auto idx) { // Update the fees @@ -208,9 +208,9 @@ void MainWindow::turnstileDoMigration() { Settings::getInstance()->getZECUSDDisplayFormat(privOptions[idx].first * Utils::getMinerFee())); }); - turnstile.privLevel->addItem("Good - 3 tx over 3 blocks"); - turnstile.privLevel->addItem("Excellent - 5 tx over 5 blocks"); - turnstile.privLevel->addItem("Paranoid - 10 tx over 7 blocks"); + turnstile.privLevel->addItem("Good - 3 tx over 6 blocks"); + turnstile.privLevel->addItem("Excellent - 5 tx over 10 blocks"); + turnstile.privLevel->addItem("Paranoid - 10 tx over 20 blocks"); turnstile.buttonBox->button(QDialogButtonBox::Ok)->setText("Start"); diff --git a/src/turnstile.cpp b/src/turnstile.cpp index 50df245..e69c9d4 100644 --- a/src/turnstile.cpp +++ b/src/turnstile.cpp @@ -9,7 +9,7 @@ using json = nlohmann::json; -Turnstile::Turnstile(RPC* _rpc, QWidget* mainwindow) { +Turnstile::Turnstile(RPC* _rpc, MainWindow* mainwindow) { this->rpc = _rpc; this->mainwindow = mainwindow; } @@ -19,8 +19,8 @@ Turnstile::~Turnstile() { void printPlan(QList plan) { for (auto item : plan) { - qDebug() << item.fromAddr << item.intTAddr - << item.destAddr << item.amount << item.blockNumber << item.status; + //qDebug() << item.fromAddr << item.intTAddr + // << item.destAddr << item.amount << item.blockNumber << item.status; } } @@ -55,7 +55,7 @@ QDataStream &operator>>(QDataStream& ds, TurnstileMigrationItem& item) { } void Turnstile::writeMigrationPlan(QList plan) { - qDebug() << QString("Writing plan"); + //qDebug() << QString("Writing plan"); printPlan(plan); QFile file(writeableFile()); @@ -159,7 +159,7 @@ QList Turnstile::splitAmount(double amount, int parts) { return amounts; fillAmounts(amounts, amount, parts); - qDebug() << amounts; + //qDebug() << amounts; // Ensure they all add up! double sumofparts = 0; @@ -170,8 +170,8 @@ QList Turnstile::splitAmount(double amount, int parts) { // Add the Tx fees 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)); + //qDebug() << QString::number(sumofparts, 'f', 8) << QString::number(amount, 'f', 8); + //Q_ASSERT(QString::number(sumofparts, 'f', 8) == QString::number(amount, 'f', 8)); return amounts; } @@ -249,7 +249,7 @@ ProgressReport Turnstile::getPlanProgress() { void Turnstile::executeMigrationStep() { auto plan = readMigrationPlan(); - qDebug() << QString("Executing step"); + //qDebug() << QString("Executing step"); printPlan(plan); // Get to the next unexecuted step @@ -282,7 +282,7 @@ void Turnstile::executeMigrationStep() { if (nextStep->status == TurnstileMigrationItemStatus::NotStarted) { // Does this z addr have enough balance? if (fnHasUnconfirmed(nextStep->fromAddr)) { - qDebug() << QString("unconfirmed, waiting"); + //qDebug() << QString("unconfirmed, waiting"); return; } @@ -318,12 +318,12 @@ void Turnstile::executeMigrationStep() { // First thing to do is check to see if the funds are confirmed. // We'll check both the original sprout address and the intermediate T addr for safety. if (fnHasUnconfirmed(nextStep->intTAddr) || fnHasUnconfirmed(nextStep->fromAddr)) { - qDebug() << QString("unconfirmed, waiting"); + //qDebug() << QString("unconfirmed, waiting"); return; } if (!rpc->getAllBalances()->keys().contains(nextStep->intTAddr)) { - qDebug() << QString("The int address doesn't have balance, even though it is confirmed"); + qDebug() << QString("The intermediate Taddress doesn't have balance, even though it is confirmed"); return; } @@ -358,8 +358,8 @@ void Turnstile::doSendTx(Tx tx, std::function cb) { std::cout << std::setw(2) << params << std::endl; rpc->sendZTransaction(params, [=] (const json& reply) { QString opid = QString::fromStdString(reply.get()); - qDebug() << opid; - //ui->statusBar->showMessage("Computing Tx: " % opid); + //qDebug() << opid; + mainwindow->ui->statusBar->showMessage("Computing Tx: " % opid); // And then start monitoring the transaction rpc->addNewTxToWatch(tx, opid); diff --git a/src/turnstile.h b/src/turnstile.h index b46d877..6eb5196 100644 --- a/src/turnstile.h +++ b/src/turnstile.h @@ -4,8 +4,10 @@ #include "precompiled.h" class RPC; +class MainWindow; struct Tx; + struct TurnstileMigrationItem { QString fromAddr; QString intTAddr; @@ -33,7 +35,7 @@ struct ProgressReport { class Turnstile { public: - Turnstile(RPC* _rpc, QWidget* mainwindow); + Turnstile(RPC* _rpc, MainWindow* mainwindow); ~Turnstile(); void planMigration(QString zaddr, QString destAddr, int splits, int numBlocks); @@ -59,7 +61,7 @@ private: QList::Iterator getNextStep(QList& plan); RPC* rpc; - QWidget* mainwindow; + MainWindow* mainwindow; }; #endif