Browse Source

Add a bunch of debug statements

chat
Duke Leto 4 years ago
parent
commit
ea495c9f69
  1. 3
      silentdragon.pro
  2. 16
      src/connection.h
  3. 8
      src/rpc.cpp

3
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

16
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<QString, bool> 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);
}

8
src/rpc.cpp

@ -427,6 +427,7 @@ void RPC::refreshReceivedZTrans(QList<QString> 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<TransactionItem> emptylist;
transactionsTableModel->addZRecvData(emptylist);
return;
@ -454,6 +455,7 @@ void RPC::refreshReceivedZTrans(QList<QString> zaddrs) {
// appears multiple times in a single tx's outputs.
QSet<QString> txids;
QMap<QString, QString> memos;
qDebug() << "Processing zaddrs...";
for (auto it = zaddrTxids->constBegin(); it != zaddrTxids->constEnd(); it++) {
auto zaddr = it.key();
for (auto& i : it.value().get<json::array_t>()) {
@ -467,16 +469,18 @@ void RPC::refreshReceivedZTrans(QList<QString> zaddrs) {
// Check for Memos
QString memoBytes = QString::fromStdString(i["memo"].get<json::string_t>());
//TODO: This should check for valid utf8!
if (!memoBytes.startsWith("f600")) {
QString memo(QByteArray::fromHex(
QByteArray::fromStdString(i["memo"].get<json::string_t>())));
QString memo(QByteArray::fromHex(QByteArray::fromStdString(i["memo"].get<json::string_t>())));
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<QString>(txids.toList(),
[=] (QString txid) {

Loading…
Cancel
Save