Browse Source

Prevent coredump in SD which should not call getmininginfo

pull/112/head
Duke 1 year ago
parent
commit
e23c845f7d
  1. 9
      src/rpc.cpp

9
src/rpc.cpp

@ -856,6 +856,7 @@ 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() );
@ -869,6 +870,13 @@ void RPC::getInfoThenRefresh(bool force) {
auto stopbutton = ui->tabWidget->findChild<QPushButton *>("stopmining");
auto startbutton = ui->tabWidget->findChild<QPushButton *>("startmining");
if (stopbutton == nullptr) {
return;
}
if (startbutton == nullptr) {
return;
}
if(generate == "1") {
// already mining
stopbutton->setEnabled(true);
@ -945,6 +953,7 @@ void RPC::getInfoThenRefresh(bool force) {
}
});
}
// Get network info
conn->doRPCIgnoreError(makePayload("getnetworkinfo"), [=](const QJsonValue& reply) {

Loading…
Cancel
Save