adding extra inputs for wownerod mining
This commit is contained in:
parent
7c4f99c85d
commit
87d7609022
|
@ -32,6 +32,7 @@ static const QHash<Config::ConfigKey, ConfigDirective> configStrings = {
|
||||||
{Config::walletPath,{QS("walletPath"), ""}},
|
{Config::walletPath,{QS("walletPath"), ""}},
|
||||||
{Config::xmrigPath,{QS("xmrigPath"), ""}},
|
{Config::xmrigPath,{QS("xmrigPath"), ""}},
|
||||||
{Config::wownerodPath, {QS("wownerodPath"), ""}},
|
{Config::wownerodPath, {QS("wownerodPath"), ""}},
|
||||||
|
{Config::extraArgs, {QS("extraArgs"), ""}},
|
||||||
{Config::nodes,{QS("nodes"), "{}"}},
|
{Config::nodes,{QS("nodes"), "{}"}},
|
||||||
{Config::websocketEnabled,{QS("websocketEnabled"), true}},
|
{Config::websocketEnabled,{QS("websocketEnabled"), true}},
|
||||||
{Config::nodeSource,{QS("nodeSource"), 0}},
|
{Config::nodeSource,{QS("nodeSource"), 0}},
|
||||||
|
|
|
@ -34,6 +34,7 @@ public:
|
||||||
walletPath,
|
walletPath,
|
||||||
xmrigPath,
|
xmrigPath,
|
||||||
wownerodPath,
|
wownerodPath,
|
||||||
|
extraArgs,
|
||||||
nodes,
|
nodes,
|
||||||
websocketEnabled,
|
websocketEnabled,
|
||||||
nodeSource,
|
nodeSource,
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include "utils/xmrig.h"
|
#include "utils/xmrig.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
XmRig::XmRig(const QString &configDir, QObject *parent) :
|
XmRig::XmRig(const QString &configDir, QObject *parent, QString extraArgs) :
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
m_statusTimer(new QTimer(this))
|
m_statusTimer(new QTimer(this))
|
||||||
{
|
{
|
||||||
|
@ -38,7 +38,7 @@ void XmRig::stop() {
|
||||||
m_statusTimer->stop();
|
m_statusTimer->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool XmRig::start(const QString &path, int threads) {
|
bool XmRig::start(const QString &path, int threads, QString extraArgs) {
|
||||||
m_ctx = MainWindow::getContext();
|
m_ctx = MainWindow::getContext();
|
||||||
|
|
||||||
auto state = m_process.state();
|
auto state = m_process.state();
|
||||||
|
@ -72,6 +72,9 @@ bool XmRig::start(const QString &path, int threads) {
|
||||||
arguments << "--start-mining" << m_ctx->currentWallet->address(0, 0);
|
arguments << "--start-mining" << m_ctx->currentWallet->address(0, 0);
|
||||||
arguments << "--spendkey" << privateSpendKey;
|
arguments << "--spendkey" << privateSpendKey;
|
||||||
|
|
||||||
|
// additional arguments to wownerod a user can define
|
||||||
|
arguments << extraArgs;
|
||||||
|
|
||||||
QString cmd = QString("%1 %2").arg(path, arguments.join(" "));
|
QString cmd = QString("%1 %2").arg(path, arguments.join(" "));
|
||||||
cmd = cmd.replace(privateSpendKey, "[redacted]");
|
cmd = cmd.replace(privateSpendKey, "[redacted]");
|
||||||
emit output(cmd.toUtf8());
|
emit output(cmd.toUtf8());
|
||||||
|
|
|
@ -27,10 +27,10 @@ class XmRig : public QObject
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit XmRig(const QString &configDir, QObject *parent = nullptr);
|
explicit XmRig(const QString &configDir, QObject *parent = nullptr, QString extraArgs = nullptr);
|
||||||
void prepare();
|
void prepare();
|
||||||
|
|
||||||
bool start(const QString &path, int threads);
|
bool start(const QString &path, int threads, QString extraArgs);
|
||||||
void stop();
|
void stop();
|
||||||
|
|
||||||
DaemonMiningState daemonMiningState = DaemonMiningState::idle;
|
DaemonMiningState daemonMiningState = DaemonMiningState::idle;
|
||||||
|
|
|
@ -63,6 +63,10 @@ XMRigWidget::XMRigWidget(AppContext *ctx, QWidget *parent) :
|
||||||
if(!path.isEmpty())
|
if(!path.isEmpty())
|
||||||
ui->lineEdit_path->setText(path);
|
ui->lineEdit_path->setText(path);
|
||||||
|
|
||||||
|
auto extraArgs = config()->get(Config::extraArgs).toString();
|
||||||
|
if(!extraArgs.isEmpty())
|
||||||
|
ui->extraArgs->setText(extraArgs);
|
||||||
|
|
||||||
connect(ui->lineEdit_path, &QLineEdit::textChanged, [=] {
|
connect(ui->lineEdit_path, &QLineEdit::textChanged, [=] {
|
||||||
config()->set(Config::wownerodPath, ui->lineEdit_path->text().trimmed());
|
config()->set(Config::wownerodPath, ui->lineEdit_path->text().trimmed());
|
||||||
});
|
});
|
||||||
|
@ -208,7 +212,8 @@ void XMRigWidget::onClearClicked() {
|
||||||
|
|
||||||
void XMRigWidget::onStartClicked() {
|
void XMRigWidget::onStartClicked() {
|
||||||
auto binPath = config()->get(Config::wownerodPath).toString();
|
auto binPath = config()->get(Config::wownerodPath).toString();
|
||||||
if(!m_ctx->XMRig->start(binPath, m_threads)) return;
|
auto extraArgs = config()->get(Config::extraArgs).toString();
|
||||||
|
if(!m_ctx->XMRig->start(binPath, m_threads, extraArgs)) return;
|
||||||
|
|
||||||
ui->btn_start->setEnabled(false);
|
ui->btn_start->setEnabled(false);
|
||||||
ui->btn_stop->setEnabled(true);
|
ui->btn_stop->setEnabled(true);
|
||||||
|
|
|
@ -227,13 +227,31 @@
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="extraArgs_label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Extra Args</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="extraArgs">
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
<widget class="QLabel" name="label_threads">
|
<widget class="QLabel" name="label_threads">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>CPU threads</string>
|
<string>CPU threads</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="3" column="1">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QSlider" name="threadSlider">
|
<widget class="QSlider" name="threadSlider">
|
||||||
|
|
Loading…
Reference in New Issue