From 0b7c908c6e2f0ee9cf80894870bd801035ed171f Mon Sep 17 00:00:00 2001 From: Duke Date: Sat, 11 Feb 2023 20:04:25 -0500 Subject: [PATCH] Render netsol in Node Info tab in SD --- src/rpc.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/rpc.cpp b/src/rpc.cpp index af4ee0b..50ac723 100644 --- a/src/rpc.cpp +++ b/src/rpc.cpp @@ -856,13 +856,22 @@ void RPC::getInfoThenRefresh(bool force) { // Get mining info // This is better+faster than calling multiple RPCs such as getlocalsolps/getnetworksolps/getgenerate // and getlocalsolps returns non-zero values even when not mining, which is not what we want - if(isdragonx) { conn->doRPCIgnoreError(makePayload("getmininginfo"), [=](const QJsonValue& reply) { QString localhashps = QString::number( reply["localhashps"].toDouble() ); QString networkhashps = QString::number( reply["networkhashps"].toDouble() ); QString generate = QString::number( reply["generate"].toBool() ); QString difficulty = QString::number( reply["difficulty"].toDouble() ); QString genproclimit = QString::number( reply["genproclimit"].toInt() ); + + // Update network hashrate in "Node Info" tab + if(isdragonx) { + ui->solrate->setText(QString::number(networkhashps.toDouble()) % " Hash/s"); + } else { + ui->solrate->setText(QString::number(networkhashps.toDouble() / 1000000) % " MegaSol/s"); + // The rest of this callback is for DRAGONX + return; + } + if ( genproclimit == "-1" ) { // Showing users they are mining with -1 threads by default is confusing genproclimit = QString::number(0); @@ -889,13 +898,6 @@ void RPC::getInfoThenRefresh(bool force) { DEBUG("enabled start mining button, disabled stop mining button"); } - // Update network hashrate in "Node Info" tab - if(isdragonx) { - ui->solrate->setText(QString::number(networkhashps.toDouble()) % " Hash/s"); - } else { - ui->solrate->setText(QString::number(networkhashps.toDouble() / 1000000) % " MegaSol/s"); - } - // find a QLCDNumber child of tabWidget named localhashrate auto localhashrate = ui->tabWidget->findChild("localhashrate"); if(localhashrate != nullptr) { @@ -953,7 +955,6 @@ void RPC::getInfoThenRefresh(bool force) { } }); - } // Get network info conn->doRPCIgnoreError(makePayload("getnetworkinfo"), [=](const QJsonValue& reply) {