Merge branch 'dev'
This commit is contained in:
commit
eae9009b98
26 changed files with 372 additions and 49 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
# v3.2.0
|
||||||
|
- Added per pool option `coin` with single possible value `monero` for pools without algorithm negotiation, for upcoming Monero fork.
|
||||||
|
- [#1183](https://github.com/xmrig/xmrig/issues/1183) Fixed compatibility with systemd.
|
||||||
|
|
||||||
# v3.1.3
|
# v3.1.3
|
||||||
- [#1180](https://github.com/xmrig/xmrig/issues/1180) Fixed possible duplicated shares after algorithm switching.
|
- [#1180](https://github.com/xmrig/xmrig/issues/1180) Fixed possible duplicated shares after algorithm switching.
|
||||||
- Fixed wrong config file permissions after write (only gcc builds on recent Windows 10 affected).
|
- Fixed wrong config file permissions after write (only gcc builds on recent Windows 10 affected).
|
||||||
|
|
|
@ -68,6 +68,7 @@ set(HEADERS_CRYPTO
|
||||||
src/crypto/cn/skein_port.h
|
src/crypto/cn/skein_port.h
|
||||||
src/crypto/cn/soft_aes.h
|
src/crypto/cn/soft_aes.h
|
||||||
src/crypto/common/Algorithm.h
|
src/crypto/common/Algorithm.h
|
||||||
|
src/crypto/common/Coin.h
|
||||||
src/crypto/common/keccak.h
|
src/crypto/common/keccak.h
|
||||||
src/crypto/common/Nonce.h
|
src/crypto/common/Nonce.h
|
||||||
src/crypto/common/portable/mm_malloc.h
|
src/crypto/common/portable/mm_malloc.h
|
||||||
|
@ -105,6 +106,7 @@ set(SOURCES_CRYPTO
|
||||||
src/crypto/cn/CnCtx.cpp
|
src/crypto/cn/CnCtx.cpp
|
||||||
src/crypto/cn/CnHash.cpp
|
src/crypto/cn/CnHash.cpp
|
||||||
src/crypto/common/Algorithm.cpp
|
src/crypto/common/Algorithm.cpp
|
||||||
|
src/crypto/common/Coin.cpp
|
||||||
src/crypto/common/keccak.cpp
|
src/crypto/common/keccak.cpp
|
||||||
src/crypto/common/Nonce.cpp
|
src/crypto/common/Nonce.cpp
|
||||||
src/crypto/common/VirtualMemory.cpp
|
src/crypto/common/VirtualMemory.cpp
|
||||||
|
|
|
@ -1,34 +1,20 @@
|
||||||
# Algorithms
|
# Algorithms
|
||||||
|
|
||||||
Since version 3 mining [algorithm](#algorithm-names) should specified for each pool separately (`algo` option), earlier versions was use one global `algo` option and per pool `variant` option (this option was removed in v3). If your pool support [mining algorithm negotiation](https://github.com/xmrig/xmrig-proxy/issues/168) you may not specify this option at all.
|
Algorithm can be defined in 3 ways:
|
||||||
|
|
||||||
#### Example
|
1. By pool, using algorithm negotiation, in this case no need specify algorithm on miner side.
|
||||||
```json
|
2. Per pool `coin` option, currently only usable value for this option is `monero`.
|
||||||
{
|
3. Per pool `algo` option.
|
||||||
"pools": [
|
|
||||||
{
|
|
||||||
"url": "...",
|
|
||||||
"algo": "cn/r",
|
|
||||||
...
|
|
||||||
}
|
|
||||||
],
|
|
||||||
...
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Pools with mining algorithm negotiation support.
|
Option `coin` useful for pools without algorithm negotiation support or daemon to allow automatically switch algorithm in next hard fork.
|
||||||
|
|
||||||
* [www.hashvault.pro](https://www.hashvault.pro/)
|
## Algorithm names
|
||||||
* [moneroocean.stream](https://moneroocean.stream)
|
|
||||||
|
|
||||||
## Algorithm names
|
|
||||||
|
|
||||||
| Name | Memory | Version | Notes |
|
| Name | Memory | Version | Notes |
|
||||||
|------|--------|---------|-------|
|
|------|--------|---------|-------|
|
||||||
|
| `rx/0` | 2 MB | 3.2.0+ | RandomX (Monero). |
|
||||||
| `argon2/chukwa` | 512 KB | 3.1.0+ | Argon2id (Chukwa). |
|
| `argon2/chukwa` | 512 KB | 3.1.0+ | Argon2id (Chukwa). |
|
||||||
| `argon2/wrkz` | 256 KB | 3.1.0+ | Argon2id (WRKZ) |
|
| `argon2/wrkz` | 256 KB | 3.1.0+ | Argon2id (WRKZ) |
|
||||||
| `rx/test` | 2 MB | 3.0.0+ | RandomX (reference configuration). |
|
|
||||||
| `rx/0` | 2 MB | 3.0.0+ | RandomX (reference configuration), reserved for future use. |
|
|
||||||
| `rx/wow` | 1 MB | 3.0.0+ | RandomWOW. |
|
| `rx/wow` | 1 MB | 3.0.0+ | RandomWOW. |
|
||||||
| `rx/loki` | 2 MB | 3.0.0+ | RandomXL. |
|
| `rx/loki` | 2 MB | 3.0.0+ | RandomXL. |
|
||||||
| `cn/fast` | 2 MB | 3.0.0+ | CryptoNight variant 1 with half iterations. |
|
| `cn/fast` | 2 MB | 3.0.0+ | CryptoNight variant 1 with half iterations. |
|
||||||
|
@ -50,3 +36,21 @@ Since version 3 mining [algorithm](#algorithm-names) should specified for each p
|
||||||
| `cn-lite/1` | 1 MB | 2.5.0+ | CryptoNight-Lite variant 1. |
|
| `cn-lite/1` | 1 MB | 2.5.0+ | CryptoNight-Lite variant 1. |
|
||||||
| `cn-lite/0` | 1 MB | 0.8.0+ | CryptoNight-Lite variant 0. |
|
| `cn-lite/0` | 1 MB | 0.8.0+ | CryptoNight-Lite variant 0. |
|
||||||
| `cn/0` | 2 MB | 0.5.0+ | CryptoNight (original). |
|
| `cn/0` | 2 MB | 0.5.0+ | CryptoNight (original). |
|
||||||
|
|
||||||
|
## Migration to v3
|
||||||
|
Since version 3 mining [algorithm](#algorithm-names) should specified for each pool separately (`algo` option), earlier versions was use one global `algo` option and per pool `variant` option (this option was removed in v3). If your pool support [mining algorithm negotiation](https://github.com/xmrig/xmrig-proxy/issues/168) you may not specify this option at all.
|
||||||
|
|
||||||
|
#### Example
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"pools": [
|
||||||
|
{
|
||||||
|
"url": "...",
|
||||||
|
"algo": "cn/r",
|
||||||
|
"coin": null
|
||||||
|
...
|
||||||
|
}
|
||||||
|
],
|
||||||
|
...
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
|
@ -150,7 +150,11 @@ void xmrig::App::onSignal(int signum)
|
||||||
void xmrig::App::close()
|
void xmrig::App::close()
|
||||||
{
|
{
|
||||||
m_signals->stop();
|
m_signals->stop();
|
||||||
|
|
||||||
|
if (m_console) {
|
||||||
m_console->stop();
|
m_console->stop();
|
||||||
|
}
|
||||||
|
|
||||||
m_controller->stop();
|
m_controller->stop();
|
||||||
|
|
||||||
Log::destroy();
|
Log::destroy();
|
||||||
|
|
|
@ -31,8 +31,11 @@
|
||||||
xmrig::Console::Console(IConsoleListener *listener)
|
xmrig::Console::Console(IConsoleListener *listener)
|
||||||
: m_listener(listener)
|
: m_listener(listener)
|
||||||
{
|
{
|
||||||
m_tty = new uv_tty_t;
|
if (!isSupported()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_tty = new uv_tty_t;
|
||||||
m_tty->data = this;
|
m_tty->data = this;
|
||||||
uv_tty_init(uv_default_loop(), m_tty, 0, 1);
|
uv_tty_init(uv_default_loop(), m_tty, 0, 1);
|
||||||
|
|
||||||
|
@ -53,6 +56,10 @@ xmrig::Console::~Console()
|
||||||
|
|
||||||
void xmrig::Console::stop()
|
void xmrig::Console::stop()
|
||||||
{
|
{
|
||||||
|
if (!m_tty) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
uv_tty_reset_mode();
|
uv_tty_reset_mode();
|
||||||
|
|
||||||
Handle::close(m_tty);
|
Handle::close(m_tty);
|
||||||
|
@ -60,6 +67,13 @@ void xmrig::Console::stop()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool xmrig::Console::isSupported() const
|
||||||
|
{
|
||||||
|
const uv_handle_type type = uv_guess_handle(0);
|
||||||
|
return type == UV_TTY || type == UV_NAMED_PIPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void xmrig::Console::onAllocBuffer(uv_handle_t *handle, size_t, uv_buf_t *buf)
|
void xmrig::Console::onAllocBuffer(uv_handle_t *handle, size_t, uv_buf_t *buf)
|
||||||
{
|
{
|
||||||
auto console = static_cast<Console*>(handle->data);
|
auto console = static_cast<Console*>(handle->data);
|
||||||
|
|
|
@ -26,9 +26,11 @@
|
||||||
#define XMRIG_CONSOLE_H
|
#define XMRIG_CONSOLE_H
|
||||||
|
|
||||||
|
|
||||||
#include <uv.h>
|
#include "base/tools/Object.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include <uv.h>
|
||||||
|
|
||||||
|
|
||||||
namespace xmrig {
|
namespace xmrig {
|
||||||
|
|
||||||
|
@ -39,18 +41,22 @@ class IConsoleListener;
|
||||||
class Console
|
class Console
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
XMRIG_DISABLE_COPY_MOVE_DEFAULT(Console)
|
||||||
|
|
||||||
Console(IConsoleListener *listener);
|
Console(IConsoleListener *listener);
|
||||||
~Console();
|
~Console();
|
||||||
|
|
||||||
void stop();
|
void stop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool isSupported() const;
|
||||||
|
|
||||||
static void onAllocBuffer(uv_handle_t *handle, size_t suggested_size, uv_buf_t *buf);
|
static void onAllocBuffer(uv_handle_t *handle, size_t suggested_size, uv_buf_t *buf);
|
||||||
static void onRead(uv_stream_t *stream, ssize_t nread, const uv_buf_t *buf);
|
static void onRead(uv_stream_t *stream, ssize_t nread, const uv_buf_t *buf);
|
||||||
|
|
||||||
char m_buf[1];
|
char m_buf[1] = { 0 };
|
||||||
IConsoleListener *m_listener;
|
IConsoleListener *m_listener;
|
||||||
uv_tty_t *m_tty;
|
uv_tty_t *m_tty = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <cstdio>
|
||||||
|
|
||||||
|
|
||||||
#include "base/tools/Handle.h"
|
#include "base/tools/Handle.h"
|
||||||
|
@ -32,9 +32,13 @@
|
||||||
#include "base/io/log/Log.h"
|
#include "base/io/log/Log.h"
|
||||||
|
|
||||||
|
|
||||||
xmrig::ConsoleLog::ConsoleLog() :
|
xmrig::ConsoleLog::ConsoleLog()
|
||||||
m_stream(nullptr)
|
|
||||||
{
|
{
|
||||||
|
if (!isSupported()) {
|
||||||
|
Log::colors = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_tty = new uv_tty_t;
|
m_tty = new uv_tty_t;
|
||||||
|
|
||||||
if (uv_tty_init(uv_default_loop(), m_tty, 1, 0) < 0) {
|
if (uv_tty_init(uv_default_loop(), m_tty, 1, 0) < 0) {
|
||||||
|
@ -66,7 +70,7 @@ xmrig::ConsoleLog::~ConsoleLog()
|
||||||
|
|
||||||
void xmrig::ConsoleLog::print(int, const char *line, size_t, size_t size, bool colors)
|
void xmrig::ConsoleLog::print(int, const char *line, size_t, size_t size, bool colors)
|
||||||
{
|
{
|
||||||
if (Log::colors != colors) {
|
if (!m_tty || Log::colors != colors) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,12 +90,18 @@ void xmrig::ConsoleLog::print(int, const char *line, size_t, size_t size, bool c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool xmrig::ConsoleLog::isSupported() const
|
||||||
|
{
|
||||||
|
const uv_handle_type type = uv_guess_handle(1);
|
||||||
|
return type == UV_TTY || type == UV_NAMED_PIPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool xmrig::ConsoleLog::isWritable() const
|
bool xmrig::ConsoleLog::isWritable() const
|
||||||
{
|
{
|
||||||
if (!m_stream || uv_is_writable(m_stream) != 1) {
|
if (!m_stream || uv_is_writable(m_stream) != 1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const uv_handle_type type = uv_guess_handle(1);
|
return isSupported();
|
||||||
return type == UV_TTY || type == UV_NAMED_PIPE;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,11 +27,12 @@
|
||||||
#define XMRIG_CONSOLELOG_H
|
#define XMRIG_CONSOLELOG_H
|
||||||
|
|
||||||
|
|
||||||
typedef struct uv_stream_s uv_stream_t;
|
using uv_stream_t = struct uv_stream_s;
|
||||||
typedef struct uv_tty_s uv_tty_t;
|
using uv_tty_t = struct uv_tty_s;
|
||||||
|
|
||||||
|
|
||||||
#include "base/kernel/interfaces/ILogBackend.h"
|
#include "base/kernel/interfaces/ILogBackend.h"
|
||||||
|
#include "base/tools/Object.h"
|
||||||
|
|
||||||
|
|
||||||
namespace xmrig {
|
namespace xmrig {
|
||||||
|
@ -40,6 +41,8 @@ namespace xmrig {
|
||||||
class ConsoleLog : public ILogBackend
|
class ConsoleLog : public ILogBackend
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
XMRIG_DISABLE_COPY_MOVE(ConsoleLog)
|
||||||
|
|
||||||
ConsoleLog();
|
ConsoleLog();
|
||||||
~ConsoleLog() override;
|
~ConsoleLog() override;
|
||||||
|
|
||||||
|
@ -47,10 +50,11 @@ protected:
|
||||||
void print(int level, const char *line, size_t offset, size_t size, bool colors) override;
|
void print(int level, const char *line, size_t offset, size_t size, bool colors) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool isSupported() const;
|
||||||
bool isWritable() const;
|
bool isWritable() const;
|
||||||
|
|
||||||
uv_stream_t *m_stream;
|
uv_stream_t *m_stream = nullptr;
|
||||||
uv_tty_t *m_tty;
|
uv_tty_t *m_tty = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,7 @@ namespace xmrig
|
||||||
|
|
||||||
static const char *kAlgo = "algo";
|
static const char *kAlgo = "algo";
|
||||||
static const char *kApi = "api";
|
static const char *kApi = "api";
|
||||||
|
static const char *kCoin = "coin";
|
||||||
static const char *kHttp = "http";
|
static const char *kHttp = "http";
|
||||||
static const char *kPools = "pools";
|
static const char *kPools = "pools";
|
||||||
|
|
||||||
|
@ -107,6 +108,15 @@ void xmrig::BaseTransform::finalize(rapidjson::Document &doc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_coin.isValid() && doc.HasMember(kPools)) {
|
||||||
|
auto &pools = doc[kPools];
|
||||||
|
for (Value &pool : pools.GetArray()) {
|
||||||
|
if (!pool.HasMember(kCoin)) {
|
||||||
|
pool.AddMember(StringRef(kCoin), m_coin.toJSON(), allocator);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -122,6 +132,15 @@ void xmrig::BaseTransform::transform(rapidjson::Document &doc, int key, const ch
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case IConfig::CoinKey: /* --coin */
|
||||||
|
if (!doc.HasMember(kPools)) {
|
||||||
|
m_coin = arg;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return add(doc, kPools, kCoin, arg);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case IConfig::UserpassKey: /* --userpass */
|
case IConfig::UserpassKey: /* --userpass */
|
||||||
{
|
{
|
||||||
const char *p = strrchr(arg, ':');
|
const char *p = strrchr(arg, ':');
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
|
|
||||||
#include "base/kernel/interfaces/IConfigTransform.h"
|
#include "base/kernel/interfaces/IConfigTransform.h"
|
||||||
|
#include "crypto/common/Coin.h"
|
||||||
#include "rapidjson/document.h"
|
#include "rapidjson/document.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -99,6 +100,7 @@ protected:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Algorithm m_algorithm;
|
Algorithm m_algorithm;
|
||||||
|
Coin m_coin;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -43,6 +43,7 @@ public:
|
||||||
enum Keys {
|
enum Keys {
|
||||||
// common
|
// common
|
||||||
AlgorithmKey = 'a',
|
AlgorithmKey = 'a',
|
||||||
|
CoinKey = 1025,
|
||||||
ApiWorkerIdKey = 4002,
|
ApiWorkerIdKey = 4002,
|
||||||
ApiIdKey = 4005,
|
ApiIdKey = 4005,
|
||||||
HttpPort = 4100,
|
HttpPort = 4100,
|
||||||
|
|
|
@ -334,6 +334,9 @@ bool xmrig::Client::parseJob(const rapidjson::Value ¶ms, int *code)
|
||||||
if (algo) {
|
if (algo) {
|
||||||
job.setAlgorithm(algo);
|
job.setAlgorithm(algo);
|
||||||
}
|
}
|
||||||
|
else if (m_pool.coin().isValid()) {
|
||||||
|
job.setAlgorithm(m_pool.coin().algorithm(job.blob()[0]));
|
||||||
|
}
|
||||||
|
|
||||||
job.setHeight(Json::getUint64(params, "height"));
|
job.setHeight(Json::getUint64(params, "height"));
|
||||||
|
|
||||||
|
@ -426,7 +429,12 @@ bool xmrig::Client::verifyAlgorithm(const Algorithm &algorithm, const char *algo
|
||||||
{
|
{
|
||||||
if (!algorithm.isValid()) {
|
if (!algorithm.isValid()) {
|
||||||
if (!isQuiet()) {
|
if (!isQuiet()) {
|
||||||
LOG_ERR("[%s] Unknown/unsupported algorithm \"%s\" detected, reconnect", url(), algo);
|
if (algo == nullptr) {
|
||||||
|
LOG_ERR("[%s] unknown algorithm, make sure you set \"algo\" or \"coin\" option", url(), algo);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
LOG_ERR("[%s] unsupported algorithm \"%s\" detected, reconnect", url(), algo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -436,7 +444,7 @@ bool xmrig::Client::verifyAlgorithm(const Algorithm &algorithm, const char *algo
|
||||||
m_listener->onVerifyAlgorithm(this, algorithm, &ok);
|
m_listener->onVerifyAlgorithm(this, algorithm, &ok);
|
||||||
|
|
||||||
if (!ok && !isQuiet()) {
|
if (!ok && !isQuiet()) {
|
||||||
LOG_ERR("[%s] Incompatible/disabled algorithm \"%s\" detected, reconnect", url(), algorithm.shortName());
|
LOG_ERR("[%s] incompatible/disabled algorithm \"%s\" detected, reconnect", url(), algorithm.shortName());
|
||||||
}
|
}
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <assert.h>
|
#include <cassert>
|
||||||
|
|
||||||
|
|
||||||
#include "3rdparty/http-parser/http_parser.h"
|
#include "3rdparty/http-parser/http_parser.h"
|
||||||
|
@ -225,6 +225,10 @@ bool xmrig::DaemonClient::parseJob(const rapidjson::Value ¶ms, int *code)
|
||||||
job.setDiff(Json::getUint64(params, "difficulty"));
|
job.setDiff(Json::getUint64(params, "difficulty"));
|
||||||
job.setId(blocktemplate.data() + blocktemplate.size() - 32);
|
job.setId(blocktemplate.data() + blocktemplate.size() - 32);
|
||||||
|
|
||||||
|
if (m_pool.coin().isValid()) {
|
||||||
|
job.setAlgorithm(m_pool.coin().algorithm(job.blob()[0]));
|
||||||
|
}
|
||||||
|
|
||||||
m_job = std::move(job);
|
m_job = std::move(job);
|
||||||
m_blocktemplate = std::move(blocktemplate);
|
m_blocktemplate = std::move(blocktemplate);
|
||||||
m_prevHash = Json::getString(params, "prev_hash");
|
m_prevHash = Json::getString(params, "prev_hash");
|
||||||
|
|
|
@ -73,6 +73,7 @@ public:
|
||||||
inline uint8_t fixedByte() const { return *(m_blob + 42); }
|
inline uint8_t fixedByte() const { return *(m_blob + 42); }
|
||||||
inline uint8_t index() const { return m_index; }
|
inline uint8_t index() const { return m_index; }
|
||||||
inline void reset() { m_size = 0; m_diff = 0; }
|
inline void reset() { m_size = 0; m_diff = 0; }
|
||||||
|
inline void setAlgorithm(const Algorithm::Id id) { m_algorithm = id; }
|
||||||
inline void setAlgorithm(const char *algo) { m_algorithm = algo; }
|
inline void setAlgorithm(const char *algo) { m_algorithm = algo; }
|
||||||
inline void setClientId(const String &id) { m_clientId = id; }
|
inline void setClientId(const String &id) { m_clientId = id; }
|
||||||
inline void setHeight(uint64_t height) { m_height = height; }
|
inline void setHeight(uint64_t height) { m_height = height; }
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
namespace xmrig {
|
namespace xmrig {
|
||||||
|
|
||||||
static const char *kAlgo = "algo";
|
static const char *kAlgo = "algo";
|
||||||
|
static const char *kCoin = "coin";
|
||||||
static const char *kDaemon = "daemon";
|
static const char *kDaemon = "daemon";
|
||||||
static const char *kDaemonPollInterval = "daemon-poll-interval";
|
static const char *kDaemonPollInterval = "daemon-poll-interval";
|
||||||
static const char *kEnabled = "enabled";
|
static const char *kEnabled = "enabled";
|
||||||
|
@ -120,6 +121,7 @@ xmrig::Pool::Pool(const rapidjson::Value &object) :
|
||||||
m_fingerprint = Json::getString(object, kFingerprint);
|
m_fingerprint = Json::getString(object, kFingerprint);
|
||||||
m_pollInterval = Json::getUint64(object, kDaemonPollInterval, kDefaultPollInterval);
|
m_pollInterval = Json::getUint64(object, kDaemonPollInterval, kDefaultPollInterval);
|
||||||
m_algorithm = Json::getString(object, kAlgo);
|
m_algorithm = Json::getString(object, kAlgo);
|
||||||
|
m_coin = Json::getString(object, kCoin);
|
||||||
|
|
||||||
m_flags.set(FLAG_ENABLED, Json::getBool(object, kEnabled, true));
|
m_flags.set(FLAG_ENABLED, Json::getBool(object, kEnabled, true));
|
||||||
m_flags.set(FLAG_NICEHASH, Json::getBool(object, kNicehash));
|
m_flags.set(FLAG_NICEHASH, Json::getBool(object, kNicehash));
|
||||||
|
@ -172,7 +174,7 @@ bool xmrig::Pool::isEnabled() const
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
if (isDaemon() && !algorithm().isValid()) {
|
if (isDaemon() && (!algorithm().isValid() && !coin().isValid())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,6 +188,7 @@ bool xmrig::Pool::isEqual(const Pool &other) const
|
||||||
&& m_keepAlive == other.m_keepAlive
|
&& m_keepAlive == other.m_keepAlive
|
||||||
&& m_port == other.m_port
|
&& m_port == other.m_port
|
||||||
&& m_algorithm == other.m_algorithm
|
&& m_algorithm == other.m_algorithm
|
||||||
|
&& m_coin == other.m_coin
|
||||||
&& m_fingerprint == other.m_fingerprint
|
&& m_fingerprint == other.m_fingerprint
|
||||||
&& m_host == other.m_host
|
&& m_host == other.m_host
|
||||||
&& m_password == other.m_password
|
&& m_password == other.m_password
|
||||||
|
@ -268,6 +271,7 @@ rapidjson::Value xmrig::Pool::toJSON(rapidjson::Document &doc) const
|
||||||
Value obj(kObjectType);
|
Value obj(kObjectType);
|
||||||
|
|
||||||
obj.AddMember(StringRef(kAlgo), m_algorithm.toJSON(), allocator);
|
obj.AddMember(StringRef(kAlgo), m_algorithm.toJSON(), allocator);
|
||||||
|
obj.AddMember(StringRef(kCoin), m_coin.toJSON(), allocator);
|
||||||
obj.AddMember(StringRef(kUrl), m_url.toJSON(), allocator);
|
obj.AddMember(StringRef(kUrl), m_url.toJSON(), allocator);
|
||||||
obj.AddMember(StringRef(kUser), m_user.toJSON(), allocator);
|
obj.AddMember(StringRef(kUser), m_user.toJSON(), allocator);
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
|
|
||||||
#include "base/tools/String.h"
|
#include "base/tools/String.h"
|
||||||
#include "crypto/common/Algorithm.h"
|
#include "crypto/common/Coin.h"
|
||||||
#include "rapidjson/fwd.h"
|
#include "rapidjson/fwd.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,6 +74,7 @@ public:
|
||||||
inline bool isTLS() const { return m_flags.test(FLAG_TLS); }
|
inline bool isTLS() const { return m_flags.test(FLAG_TLS); }
|
||||||
inline bool isValid() const { return !m_host.isNull() && m_port > 0; }
|
inline bool isValid() const { return !m_host.isNull() && m_port > 0; }
|
||||||
inline const Algorithm &algorithm() const { return m_algorithm; }
|
inline const Algorithm &algorithm() const { return m_algorithm; }
|
||||||
|
inline const Coin &coin() const { return m_coin; }
|
||||||
inline const String &fingerprint() const { return m_fingerprint; }
|
inline const String &fingerprint() const { return m_fingerprint; }
|
||||||
inline const String &host() const { return m_host; }
|
inline const String &host() const { return m_host; }
|
||||||
inline const String &password() const { return !m_password.isNull() ? m_password : kDefaultPassword; }
|
inline const String &password() const { return !m_password.isNull() ? m_password : kDefaultPassword; }
|
||||||
|
@ -107,6 +108,7 @@ private:
|
||||||
bool parseIPv6(const char *addr);
|
bool parseIPv6(const char *addr);
|
||||||
|
|
||||||
Algorithm m_algorithm;
|
Algorithm m_algorithm;
|
||||||
|
Coin m_coin;
|
||||||
int m_keepAlive;
|
int m_keepAlive;
|
||||||
std::bitset<FLAG_MAX> m_flags;
|
std::bitset<FLAG_MAX> m_flags;
|
||||||
String m_fingerprint;
|
String m_fingerprint;
|
||||||
|
|
|
@ -135,11 +135,12 @@ void xmrig::Pools::print() const
|
||||||
{
|
{
|
||||||
size_t i = 1;
|
size_t i = 1;
|
||||||
for (const Pool &pool : m_data) {
|
for (const Pool &pool : m_data) {
|
||||||
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("POOL #%-7zu") CSI "1;%dm%s" CLEAR " algo " WHITE_BOLD("%s"),
|
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("POOL #%-7zu") CSI "1;%dm%s" CLEAR " %s " WHITE_BOLD("%s"),
|
||||||
i,
|
i,
|
||||||
(pool.isEnabled() ? (pool.isTLS() ? 32 : 36) : 31),
|
(pool.isEnabled() ? (pool.isTLS() ? 32 : 36) : 31),
|
||||||
pool.url().data(),
|
pool.url().data(),
|
||||||
pool.algorithm().isValid() ? pool.algorithm().shortName() : "auto"
|
pool.coin().isValid() ? "coin" : "algo",
|
||||||
|
pool.coin().isValid() ? pool.coin().name() : (pool.algorithm().isValid() ? pool.algorithm().shortName() : "auto")
|
||||||
);
|
);
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
|
|
52
src/base/tools/Object.h
Normal file
52
src/base/tools/Object.h
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
/* XMRig
|
||||||
|
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||||
|
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||||
|
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||||
|
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||||
|
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||||
|
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||||
|
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||||
|
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef XMRIG_OBJECT_H
|
||||||
|
#define XMRIG_OBJECT_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
|
|
||||||
|
|
||||||
|
namespace xmrig {
|
||||||
|
|
||||||
|
|
||||||
|
#define XMRIG_DISABLE_COPY_MOVE(X) \
|
||||||
|
X(const X &other) = delete; \
|
||||||
|
X(X &&other) = delete; \
|
||||||
|
X &operator=(const X &other) = delete; \
|
||||||
|
X &operator=(X &&other) = delete;
|
||||||
|
|
||||||
|
|
||||||
|
#define XMRIG_DISABLE_COPY_MOVE_DEFAULT(X) \
|
||||||
|
X() = delete; \
|
||||||
|
X(const X &other) = delete; \
|
||||||
|
X(X &&other) = delete; \
|
||||||
|
X &operator=(const X &other) = delete; \
|
||||||
|
X &operator=(X &&other) = delete;
|
||||||
|
|
||||||
|
|
||||||
|
} /* namespace xmrig */
|
||||||
|
|
||||||
|
#endif /* XMRIG_OBJECT_H */
|
|
@ -34,6 +34,7 @@
|
||||||
"pools": [
|
"pools": [
|
||||||
{
|
{
|
||||||
"algo": null,
|
"algo": null,
|
||||||
|
"coin": null,
|
||||||
"url": "donate.v2.xmrig.com:3333",
|
"url": "donate.v2.xmrig.com:3333",
|
||||||
"user": "YOUR_WALLET_ADDRESS",
|
"user": "YOUR_WALLET_ADDRESS",
|
||||||
"pass": "x",
|
"pass": "x",
|
||||||
|
|
|
@ -68,6 +68,7 @@ R"===(
|
||||||
"pools": [
|
"pools": [
|
||||||
{
|
{
|
||||||
"algo": null,
|
"algo": null,
|
||||||
|
"coin": null,
|
||||||
"url": "donate.v2.xmrig.com:3333",
|
"url": "donate.v2.xmrig.com:3333",
|
||||||
"user": "YOUR_WALLET_ADDRESS",
|
"user": "YOUR_WALLET_ADDRESS",
|
||||||
"pass": "x",
|
"pass": "x",
|
||||||
|
|
|
@ -45,6 +45,7 @@ static const char short_options[] = "a:c:kBp:Px:r:R:s:t:T:o:u:O:v:l:S";
|
||||||
|
|
||||||
static const option options[] = {
|
static const option options[] = {
|
||||||
{ "algo", 1, nullptr, IConfig::AlgorithmKey },
|
{ "algo", 1, nullptr, IConfig::AlgorithmKey },
|
||||||
|
{ "coin", 1, nullptr, IConfig::CoinKey },
|
||||||
{ "api-worker-id", 1, nullptr, IConfig::ApiWorkerIdKey },
|
{ "api-worker-id", 1, nullptr, IConfig::ApiWorkerIdKey },
|
||||||
{ "api-id", 1, nullptr, IConfig::ApiIdKey },
|
{ "api-id", 1, nullptr, IConfig::ApiIdKey },
|
||||||
{ "http-enabled", 0, nullptr, IConfig::HttpEnabledKey },
|
{ "http-enabled", 0, nullptr, IConfig::HttpEnabledKey },
|
||||||
|
|
|
@ -60,6 +60,7 @@ Options:\n\
|
||||||
rx/wow, rx/loki\n"
|
rx/wow, rx/loki\n"
|
||||||
#endif
|
#endif
|
||||||
"\
|
"\
|
||||||
|
--coin=COIN specify coin instead of algorithm\
|
||||||
-o, --url=URL URL of mining server\n\
|
-o, --url=URL URL of mining server\n\
|
||||||
-O, --userpass=U:P username:password pair for mining server\n\
|
-O, --userpass=U:P username:password pair for mining server\n\
|
||||||
-u, --user=USERNAME username for mining server\n\
|
-u, --user=USERNAME username for mining server\n\
|
||||||
|
|
|
@ -107,9 +107,8 @@ static AlgoName const algorithm_names[] = {
|
||||||
{ "cryptonight_turtle", "cn_turtle", Algorithm::CN_PICO_0 },
|
{ "cryptonight_turtle", "cn_turtle", Algorithm::CN_PICO_0 },
|
||||||
# endif
|
# endif
|
||||||
# ifdef XMRIG_ALGO_RANDOMX
|
# ifdef XMRIG_ALGO_RANDOMX
|
||||||
|
{ "randomx/0", "rx/0", Algorithm::RX_0 },
|
||||||
{ "randomx/test", "rx/test", Algorithm::RX_0 },
|
{ "randomx/test", "rx/test", Algorithm::RX_0 },
|
||||||
{ "randomx/0", "rx/0", Algorithm::RX_0 },
|
|
||||||
{ "randomx/0", "rx/0", Algorithm::RX_0 },
|
|
||||||
{ "RandomX", "rx", Algorithm::RX_0 },
|
{ "RandomX", "rx", Algorithm::RX_0 },
|
||||||
{ "randomx/wow", "rx/wow", Algorithm::RX_WOW },
|
{ "randomx/wow", "rx/wow", Algorithm::RX_WOW },
|
||||||
{ "RandomWOW", nullptr, Algorithm::RX_WOW },
|
{ "RandomWOW", nullptr, Algorithm::RX_WOW },
|
||||||
|
|
103
src/crypto/common/Coin.cpp
Normal file
103
src/crypto/common/Coin.cpp
Normal file
|
@ -0,0 +1,103 @@
|
||||||
|
/* XMRig
|
||||||
|
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||||
|
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||||
|
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||||
|
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||||
|
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||||
|
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||||
|
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
|
||||||
|
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||||
|
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "crypto/common/Coin.h"
|
||||||
|
#include "rapidjson/document.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
# define strcasecmp _stricmp
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
namespace xmrig {
|
||||||
|
|
||||||
|
|
||||||
|
struct CoinName
|
||||||
|
{
|
||||||
|
const char *name;
|
||||||
|
const Coin::Id id;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static CoinName const coin_names[] = {
|
||||||
|
{ "monero", Coin::MONERO },
|
||||||
|
{ "xmr", Coin::MONERO },
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
} /* namespace xmrig */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
xmrig::Algorithm::Id xmrig::Coin::algorithm(uint8_t blobVersion) const
|
||||||
|
{
|
||||||
|
if (id() == MONERO) {
|
||||||
|
return (blobVersion >= 12) ? Algorithm::RX_0 : Algorithm::CN_R;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Algorithm::INVALID;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const char *xmrig::Coin::name() const
|
||||||
|
{
|
||||||
|
for (const auto &i : coin_names) {
|
||||||
|
if (i.id == m_id) {
|
||||||
|
return i.name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
rapidjson::Value xmrig::Coin::toJSON() const
|
||||||
|
{
|
||||||
|
using namespace rapidjson;
|
||||||
|
|
||||||
|
return isValid() ? Value(StringRef(name())) : Value(kNullType);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
xmrig::Coin::Id xmrig::Coin::parse(const char *name)
|
||||||
|
{
|
||||||
|
if (name == nullptr || strlen(name) < 3) {
|
||||||
|
return INVALID;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const auto &i : coin_names) {
|
||||||
|
if (strcasecmp(name, i.name) == 0) {
|
||||||
|
return i.id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return INVALID;
|
||||||
|
}
|
75
src/crypto/common/Coin.h
Normal file
75
src/crypto/common/Coin.h
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
/* XMRig
|
||||||
|
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||||
|
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||||
|
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||||
|
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||||
|
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||||
|
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||||
|
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
|
||||||
|
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||||
|
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef XMRIG_COIN_H
|
||||||
|
#define XMRIG_COIN_H
|
||||||
|
|
||||||
|
|
||||||
|
#include "crypto/common/Algorithm.h"
|
||||||
|
#include "rapidjson/fwd.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace xmrig {
|
||||||
|
|
||||||
|
|
||||||
|
class Coin
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum Id : int {
|
||||||
|
INVALID = -1,
|
||||||
|
MONERO,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Coin() = default;
|
||||||
|
inline Coin(const char *name) : m_id(parse(name)) {}
|
||||||
|
inline Coin(Id id) : m_id(id) {}
|
||||||
|
|
||||||
|
|
||||||
|
inline bool isEqual(const Coin &other) const { return m_id == other.m_id; }
|
||||||
|
inline bool isValid() const { return m_id != INVALID; }
|
||||||
|
inline Id id() const { return m_id; }
|
||||||
|
|
||||||
|
Algorithm::Id algorithm(uint8_t blobVersion) const;
|
||||||
|
const char *name() const;
|
||||||
|
rapidjson::Value toJSON() const;
|
||||||
|
|
||||||
|
inline bool operator!=(Coin::Id id) const { return m_id != id; }
|
||||||
|
inline bool operator!=(const Coin &other) const { return !isEqual(other); }
|
||||||
|
inline bool operator==(Coin::Id id) const { return m_id == id; }
|
||||||
|
inline bool operator==(const Coin &other) const { return isEqual(other); }
|
||||||
|
inline operator Coin::Id() const { return m_id; }
|
||||||
|
|
||||||
|
static Id parse(const char *name);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Id m_id = INVALID;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
} /* namespace xmrig */
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* XMRIG_COIN_H */
|
|
@ -28,15 +28,15 @@
|
||||||
#define APP_ID "xmrig"
|
#define APP_ID "xmrig"
|
||||||
#define APP_NAME "XMRig"
|
#define APP_NAME "XMRig"
|
||||||
#define APP_DESC "XMRig CPU miner"
|
#define APP_DESC "XMRig CPU miner"
|
||||||
#define APP_VERSION "3.1.3"
|
#define APP_VERSION "3.2.0-dev"
|
||||||
#define APP_DOMAIN "xmrig.com"
|
#define APP_DOMAIN "xmrig.com"
|
||||||
#define APP_SITE "www.xmrig.com"
|
#define APP_SITE "www.xmrig.com"
|
||||||
#define APP_COPYRIGHT "Copyright (C) 2016-2019 xmrig.com"
|
#define APP_COPYRIGHT "Copyright (C) 2016-2019 xmrig.com"
|
||||||
#define APP_KIND "cpu"
|
#define APP_KIND "cpu"
|
||||||
|
|
||||||
#define APP_VER_MAJOR 3
|
#define APP_VER_MAJOR 3
|
||||||
#define APP_VER_MINOR 1
|
#define APP_VER_MINOR 2
|
||||||
#define APP_VER_PATCH 3
|
#define APP_VER_PATCH 0
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
# if (_MSC_VER >= 1920)
|
# if (_MSC_VER >= 1920)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue