diff --git a/silentdragon.pro b/silentdragon.pro index ba7b651..c7d69b4 100644 --- a/silentdragon.pro +++ b/silentdragon.pro @@ -1,3 +1,5 @@ +// Copyright 2019-2020 The Hush developers +// GPLv3 #------------------------------------------------- # # Project created by QtCreator 2018-10-05T09:54:45 @@ -14,7 +16,6 @@ QT += widgets QT += websockets TARGET = silentdragon - TEMPLATE = app # The following define makes your compiler emit warnings if you use diff --git a/src/connection.h b/src/connection.h index dc0a54d..b28a741 100644 --- a/src/connection.h +++ b/src/connection.h @@ -1,3 +1,5 @@ +// Copyright 2019-2020 The Hush developers +// Released under the GPLv3 #ifndef CONNECTION_H #define CONNECTION_H @@ -84,7 +86,7 @@ private: }; /** - * Represents a connection to a zcashd. It may even start a new zcashd if needed. + * Represents a connection to a hushd. It may even start a new hushd if needed. * This is also a UI class, so it may show a dialog waiting for the connection. */ class Connection { @@ -121,6 +123,7 @@ public: static QMap inProgress; QString method = QString::fromStdString(payloadGenerator(payloads[0])["method"]); + qDebug() << __func__ << " with method=" << method << " and totalSize=" << totalSize; //if (inProgress.value(method, false)) { // qDebug() << "In progress batch, skipping"; // return; @@ -135,11 +138,12 @@ public: QObject::connect(reply, &QNetworkReply::finished, [=] { reply->deleteLater(); if (shutdownInProgress) { - // Ignoring callback because shutdown in progress + qDebug() << "Ignoring callback because shutdown in progress"; return; } - auto all = reply->readAll(); + auto all = reply->readAll(); + qDebug() << "Parsing JSON..."; auto parsed = json::parse(all.toStdString(), nullptr, false); if (reply->error() != QNetworkReply::NoError) { @@ -149,8 +153,10 @@ public: (*responses)[item] = json::object(); // Empty object } else { if (parsed.is_discarded()) { + qDebug() << "Discarded response!"; (*responses)[item] = json::object(); // Empty object } else { + qDebug() << "Parsed valid JSON"; (*responses)[item] = parsed["result"]; } } @@ -158,8 +164,10 @@ public: } auto waitTimer = new QTimer(main); + qDebug() << "Created timer..."; QObject::connect(waitTimer, &QTimer::timeout, [=]() { if (shutdownInProgress) { + qDebug() << "Shutdown in progress, removing timer"; waitTimer->stop(); waitTimer->deleteLater(); return; @@ -167,6 +175,7 @@ public: // If all responses have arrived, return if (responses->size() == totalSize) { + qDebug() << "Response arrived, removing timer..."; waitTimer->stop(); @@ -176,6 +185,7 @@ public: waitTimer->deleteLater(); } }); + qDebug() << "Starting timer..."; waitTimer->start(100); } diff --git a/src/rpc.cpp b/src/rpc.cpp index 3d9fa8b..197eeda 100644 --- a/src/rpc.cpp +++ b/src/rpc.cpp @@ -427,6 +427,7 @@ void RPC::refreshReceivedZTrans(QList zaddrs) { // We'll only refresh the received Z txs if settings allows us. if (!Settings::getInstance()->getSaveZtxs()) { + qDebug() << "Settings have saved zaddr transactions OFF, showing empty list"; QList emptylist; transactionsTableModel->addZRecvData(emptylist); return; @@ -454,6 +455,7 @@ void RPC::refreshReceivedZTrans(QList zaddrs) { // appears multiple times in a single tx's outputs. QSet txids; QMap memos; + qDebug() << "Processing zaddrs..."; for (auto it = zaddrTxids->constBegin(); it != zaddrTxids->constEnd(); it++) { auto zaddr = it.key(); for (auto& i : it.value().get()) { @@ -467,16 +469,18 @@ void RPC::refreshReceivedZTrans(QList zaddrs) { // Check for Memos QString memoBytes = QString::fromStdString(i["memo"].get()); + //TODO: This should check for valid utf8! if (!memoBytes.startsWith("f600")) { - QString memo(QByteArray::fromHex( - QByteArray::fromStdString(i["memo"].get()))); + QString memo(QByteArray::fromHex(QByteArray::fromStdString(i["memo"].get()))); if (!memo.trimmed().isEmpty()) + qDebug() << "Found a memo for txid=" << txid; memos[zaddr + txid] = memo; } } } } + qDebug() << "Processing all txids..."; // 2. For all txids, go and get the details of that txid. conn->doBatchRPC(txids.toList(), [=] (QString txid) {