From 4312cb67e8cc8c7f78588fe7395d18e3fc97dd5e Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Sun, 4 Oct 2020 10:42:37 -0400 Subject: [PATCH] Show number of TLS connections in hushd tab --- src/rpc.cpp | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/src/rpc.cpp b/src/rpc.cpp index 6134c20..221f227 100644 --- a/src/rpc.cpp +++ b/src/rpc.cpp @@ -601,7 +601,10 @@ void RPC::getInfoThenRefresh(bool force) { refreshTransactions(); } - int connections = reply["connections"].toInt(); + int connections = reply["connections"].toInt(); + bool hasTLS = !reply["tls_connections"].isNull(); + qDebug() << "Local node TLS support = " << hasTLS; + int tlsconnections = hasTLS ? reply["tls_connections"].toInt() : 0; Settings::getInstance()->setPeers(connections); if (connections == 0) { @@ -611,28 +614,16 @@ void RPC::getInfoThenRefresh(bool force) { } // Get network sol/s - QJsonObject payload = { - {"jsonrpc", "1.0"}, - {"id", "someid"}, - {"method", "getnetworksolps"} - }; - QString method = "getnetworksolps"; conn->doRPCIgnoreError(makePayload(method), [=](const QJsonValue& reply) { qint64 solrate = reply.toInt(); - ui->numconnections->setText(QString::number(connections)); + ui->numconnections->setText(QString::number(connections) + " (" + QString::number(tlsconnections) + " TLS)" ); ui->solrate->setText(QString::number(solrate) % " Sol/s"); }); // Get network info - payload = { - {"jsonrpc", "1.0"}, - {"id", "someid"}, - {"method", "getnetworkinfo"} - }; - - conn->doRPCIgnoreError(payload, [=](const QJsonValue& reply) { + conn->doRPCIgnoreError(makePayload("getnetworkinfo"), [=](const QJsonValue& reply) { QString clientname = reply["subversion"].toString(); QString localservices = reply["localservices"].toString(); @@ -640,7 +631,6 @@ void RPC::getInfoThenRefresh(bool force) { ui->localservices->setText(localservices); }); - conn->doRPCIgnoreError(makePayload("getwalletinfo"), [=](const QJsonValue& reply) { int txcount = reply["txcount"].toInt(); ui->txcount->setText(QString::number(txcount));