diff --git a/src/rpc.cpp b/src/rpc.cpp index aeec65b..616aca8 100644 --- a/src/rpc.cpp +++ b/src/rpc.cpp @@ -108,7 +108,7 @@ json RPC::makePayload(std::string method, std::string params) { {"method", method }, {"params", {params}} }; - return payload; + return payload; } json RPC::makePayload(std::string method) { @@ -117,7 +117,7 @@ json RPC::makePayload(std::string method) { {"id", "42" }, {"method", method }, }; - return payload; + return payload; } void RPC::getTAddresses(const std::function& cb) { @@ -961,35 +961,34 @@ void RPC::watchTxStatus() { return noConnection(); // Make an RPC to load pending operation statues - json payload = { - {"jsonrpc", "1.0"}, - {"id", "someid"}, - {"method", "z_getoperationstatus"}, - }; - - conn->doRPCIgnoreError(payload, [=] (const json& reply) { + conn->doRPCIgnoreError(makePayload("z_getoperationstatus"), [=] (const json& reply) { + // conn->doRPCIgnoreError(payload, [=] (const json& reply) { // There's an array for each item in the status for (auto& it : reply.get()) { // If we were watching this Tx and its status became "success", then we'll show a status bar alert QString id = QString::fromStdString(it["id"]); if (watchingOps.contains(id)) { + // log any txs we are watching + // "creation_time": 1515969376, + // "execution_secs": 50.416337, // And if it ended up successful QString status = QString::fromStdString(it["status"]); main->loadingLabel->setVisible(false); if (status == "success") { auto txid = QString::fromStdString(it["result"]["txid"]); - SentTxStore::addToSentTx(watchingOps[id].tx, txid); auto wtx = watchingOps[id]; watchingOps.remove(id); wtx.completed(id, txid); - // Refresh balances to show unconfirmed balances + qDebug() << "opid "<< id << " started at "<loadingLabel->setVisible(false); } else { main->loadingLabel->setVisible(true); - main->loadingLabel->setToolTip(QString::number(watchingOps.size()) + QObject::tr(" tx computing. This can take several minutes.")); + main->loadingLabel->setToolTip(QString::number(watchingOps.size()) + QObject::tr(" transaction computing.")); } }); } diff --git a/src/sendtab.cpp b/src/sendtab.cpp index 99867b6..450d34f 100644 --- a/src/sendtab.cpp +++ b/src/sendtab.cpp @@ -1,3 +1,4 @@ +// Copyright 2019 The Hush developers #include "mainwindow.h" #include "ui_mainwindow.h" #include "addressbook.h" @@ -705,27 +706,28 @@ void MainWindow::sendButton() { // abort the Tx return; } - + // Show a dialog to confirm the Tx if (confirmTx(tx)) { // And send the Tx - rpc->executeTransaction(tx, + rpc->executeTransaction(tx, [=] (QString opid) { - ui->statusBar->showMessage(tr("Computing Tx: ") % opid); + ui->statusBar->showMessage(tr("Computing transaction: ") % opid); + qDebug() << "Computing opid: " << opid; }, [=] (QString, QString txid) { ui->statusBar->showMessage(Settings::txidStatusMessage + " " + txid); }, [=] (QString opid, QString errStr) { - ui->statusBar->showMessage(QObject::tr(" Tx ") % opid % QObject::tr(" failed"), 15 * 1000); + ui->statusBar->showMessage(QObject::tr(" Transaction ") % opid % QObject::tr(" failed"), 15 * 1000); if (!opid.isEmpty()) errStr = QObject::tr("The transaction with id ") % opid % QObject::tr(" failed. The error was") + ":\n\n" + errStr; - QMessageBox::critical(this, QObject::tr("Transaction Error"), errStr, QMessageBox::Ok); + QMessageBox::critical(this, QObject::tr("Transaction Error"), errStr, QMessageBox::Ok); } ); - } + } } QString MainWindow::doSendTxValidations(Tx tx) {