diff --git a/CMakeLists.txt b/CMakeLists.txt index 25c204095..b26b1d93a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,7 @@ set(HEADERS src/common/config/ConfigLoader.h src/common/config/ConfigWatcher.h src/common/Console.h + src/common/crypto/Algorithm.h src/common/crypto/keccak.h src/common/log/ConsoleLog.h src/common/log/FileLog.h @@ -93,6 +94,7 @@ set(SOURCES src/common/config/ConfigLoader.cpp src/common/config/ConfigWatcher.cpp src/common/Console.cpp + src/common/crypto/Algorithm.cpp src/common/crypto/keccak.cpp src/common/log/ConsoleLog.cpp src/common/log/FileLog.cpp diff --git a/src/Summary.cpp b/src/Summary.cpp index a52b79454..e960dd8de 100644 --- a/src/Summary.cpp +++ b/src/Summary.cpp @@ -104,7 +104,7 @@ static void print_threads(xmrig::Config *config) Log::i()->text(config->isColors() ? "\x1B[01;32m * \x1B[01;37mTHREADS: \x1B[01;36m%d\x1B[01;37m, %s, av=%d, %sdonate=%d%%%s" : " * THREADS: %d, %s, av=%d, %sdonate=%d%%%s", config->threadsCount(), - config->algoName(), + config->algorithm().name(), config->algoVariant(), config->isColors() && config->donateLevel() == 0 ? "\x1B[01;31m" : "", config->donateLevel(), @@ -113,7 +113,7 @@ static void print_threads(xmrig::Config *config) else { Log::i()->text(config->isColors() ? "\x1B[01;32m * \x1B[01;37mTHREADS: \x1B[01;36m%d\x1B[01;37m, %s, %sdonate=%d%%" : " * THREADS: %d, %s, %sdonate=%d%%", config->threadsCount(), - config->algoName(), + config->algorithm().name(), config->isColors() && config->donateLevel() == 0 ? "\x1B[01;31m" : "", config->donateLevel()); } diff --git a/src/api/ApiRouter.cpp b/src/api/ApiRouter.cpp index a9e32b18a..07e425f18 100644 --- a/src/api/ApiRouter.cpp +++ b/src/api/ApiRouter.cpp @@ -244,7 +244,7 @@ void ApiRouter::getMiner(rapidjson::Document &doc) const doc.AddMember("kind", APP_KIND, allocator); doc.AddMember("ua", rapidjson::StringRef(Platform::userAgent()), allocator); doc.AddMember("cpu", cpu, allocator); - doc.AddMember("algo", rapidjson::StringRef(m_controller->config()->algoName()), allocator); + doc.AddMember("algo", rapidjson::StringRef(m_controller->config()->algorithm().name()), allocator); doc.AddMember("hugepages", Workers::hugePages() > 0, allocator); doc.AddMember("donate_level", m_controller->config()->donateLevel(), allocator); } diff --git a/src/common/config/CommonConfig.cpp b/src/common/config/CommonConfig.cpp index baf5a7292..5bad4af54 100644 --- a/src/common/config/CommonConfig.cpp +++ b/src/common/config/CommonConfig.cpp @@ -38,7 +38,6 @@ xmrig::CommonConfig::CommonConfig() : - m_algorithm(CRYPTONIGHT), m_adjusted(false), m_apiIPv6(false), m_apiRestricted(true), @@ -80,8 +79,12 @@ bool xmrig::CommonConfig::adjust() m_adjusted = true; + if (!m_algorithm.isValid()) { + m_algorithm.setAlgo(CRYPTONIGHT); + } + for (Pool &pool : m_pools) { - pool.adjust(algorithm()); + pool.adjust(m_algorithm.algo()); } return true; @@ -90,7 +93,7 @@ bool xmrig::CommonConfig::adjust() bool xmrig::CommonConfig::isValid() const { - return m_pools[0].isValid() && m_algorithm != INVALID_ALGO; + return m_pools[0].isValid() && m_algorithm.isValid(); } @@ -141,7 +144,7 @@ bool xmrig::CommonConfig::parseString(int key, const char *arg) { switch (key) { case AlgorithmKey: /* --algo */ - m_algorithm = Pool::algorithm(arg); + m_algorithm.parseAlgorithm(arg); break; case UserpassKey: /* --userpass */ @@ -181,6 +184,10 @@ bool xmrig::CommonConfig::parseString(int key, const char *arg) m_pools.back().setRigId(arg); break; + case VariantKey: /* --variant */ + m_pools.back().algorithm().parseVariant(arg); + break; + case LogFileKey: /* --log-file */ m_logFile = arg; break; @@ -199,7 +206,6 @@ bool xmrig::CommonConfig::parseString(int key, const char *arg) case RetriesKey: /* --retries */ case RetryPauseKey: /* --retry-pause */ - case VariantKey: /* --variant */ case ApiPort: /* --api-port */ case PrintTimeKey: /* --cpu-priority */ return parseUint64(key, strtol(arg, nullptr, 10)); @@ -299,7 +305,7 @@ bool xmrig::CommonConfig::parseInt(int key, int arg) break; case VariantKey: /* --variant */ - m_pools.back().setVariant(arg); + m_pools.back().algorithm().parseVariant(arg); break; case DonateLevelKey: /* --donate-level */ diff --git a/src/common/config/CommonConfig.h b/src/common/config/CommonConfig.h index ebeb41fef..b04de6eba 100644 --- a/src/common/config/CommonConfig.h +++ b/src/common/config/CommonConfig.h @@ -43,13 +43,12 @@ public: CommonConfig(); ~CommonConfig(); - inline Algo algorithm() const { return m_algorithm; } inline bool isApiIPv6() const { return m_apiIPv6; } inline bool isApiRestricted() const { return m_apiRestricted; } inline bool isBackground() const { return m_background; } inline bool isColors() const { return m_colors; } inline bool isSyslog() const { return m_syslog; } - inline const char *algoName() const { return Pool::algoName(m_algorithm); } + inline const Algorithm &algorithm() const { return m_algorithm; } inline const char *apiToken() const { return m_apiToken.data(); } inline const char *apiWorkerId() const { return m_apiWorkerId.data(); } inline const char *logFile() const { return m_logFile.data(); } @@ -74,7 +73,7 @@ protected: bool save() override; void setFileName(const char *fileName) override; - Algo m_algorithm; + Algorithm m_algorithm; bool m_adjusted; bool m_apiIPv6; bool m_apiRestricted; diff --git a/src/common/crypto/Algorithm.cpp b/src/common/crypto/Algorithm.cpp new file mode 100644 index 000000000..2e13fffd5 --- /dev/null +++ b/src/common/crypto/Algorithm.cpp @@ -0,0 +1,158 @@ +/* XMRig + * Copyright 2010 Jeff Garzik + * Copyright 2012-2014 pooler + * Copyright 2014 Lucas Jones + * Copyright 2014-2016 Wolf9466 + * Copyright 2016 Jay D Dee + * Copyright 2017-2018 XMR-Stak , + * Copyright 2018 Lee Clagett + * Copyright 2016-2018 XMRig , + * + * 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 . + */ + + +#include +#include +#include +#include + + +#include "common/crypto/Algorithm.h" + + +#ifdef _MSC_VER +# define strncasecmp _strnicmp +# define strcasecmp _stricmp +#endif + + +#ifndef ARRAY_SIZE +# define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) +#endif + + +struct AlgoData +{ + const char *name; + const char *shortName; + xmrig::Algo algo; + xmrig::Variant variant; +}; + + +static AlgoData const algorithms[] = { + { "cryptonight", "cn", xmrig::CRYPTONIGHT, xmrig::VARIANT_AUTO }, + { "cryptonight/0", "cn/0", xmrig::CRYPTONIGHT, xmrig::VARIANT_0 }, + { "cryptonight/1", "cn/1", xmrig::CRYPTONIGHT, xmrig::VARIANT_1 }, + { "cryptonight/xtl", "cn/xtl", xmrig::CRYPTONIGHT, xmrig::VARIANT_XTL }, + +# ifndef XMRIG_NO_AEON + { "cryptonight-lite", "cn-lite", xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_AUTO }, + { "cryptonight-lite/0", "cn-lite/0", xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_0 }, + { "cryptonight-lite/1", "cn-lite/1", xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_1 }, + { "cryptonight-lite/ipbc", "cn-lite/ipbc", xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_IBPC }, +# endif + +# ifndef XMRIG_NO_SUMO + { "cryptonight-heavy", "cn-heavy", xmrig::CRYPTONIGHT_HEAVY, xmrig::VARIANT_0 }, +# endif +}; + + +static const char *variants[] = { + "0", + "1", + "ipbc", + "xtl" +}; + + +const char *xmrig::Algorithm::variantName() const +{ + if (m_variant == VARIANT_AUTO) { + return "auto"; + } + + return variants[m_variant]; +} + + +void xmrig::Algorithm::parseAlgorithm(const char *algo) +{ + m_algo = INVALID_ALGO; + m_variant = VARIANT_AUTO; + + for (size_t i = 0; i < ARRAY_SIZE(algorithms); i++) { + if ((strcasecmp(algo, algorithms[i].name) == 0) || (strcasecmp(algo, algorithms[i].shortName) == 0)) { + m_algo = algorithms[i].algo; + m_variant = algorithms[i].variant; + break; + } + } + + if (m_algo == INVALID_ALGO) { + assert(false); + } +} + + +void xmrig::Algorithm::parseVariant(const char *variant) +{ + if (m_algo == CRYPTONIGHT_HEAVY) { + return; + } + + m_variant = VARIANT_AUTO; + + for (size_t i = 0; i < ARRAY_SIZE(variants); i++) { + if (strcasecmp(variant, variants[i]) == 0) { + m_variant = static_cast(i); + break; + } + } +} + + +void xmrig::Algorithm::parseVariant(int variant) +{ + if (variant >= VARIANT_AUTO && variant <= VARIANT_XTL) { + m_variant = static_cast(variant); + } + else { + assert(false); + } +} + + +void xmrig::Algorithm::setAlgo(Algo algo) +{ + m_algo = algo; + + if (m_algo == CRYPTONIGHT_HEAVY) { + m_variant = VARIANT_0; + } +} + + +const char *xmrig::Algorithm::name(bool shortName) const +{ + for (size_t i = 0; i < ARRAY_SIZE(algorithms); i++) { + if (algorithms[i].algo == m_algo && algorithms[i].variant == m_variant) { + return shortName ? algorithms[i].shortName : algorithms[i].name; + } + } + + return "invalid"; +} diff --git a/src/common/crypto/Algorithm.h b/src/common/crypto/Algorithm.h new file mode 100644 index 000000000..bbabb40fc --- /dev/null +++ b/src/common/crypto/Algorithm.h @@ -0,0 +1,76 @@ +/* XMRig + * Copyright 2010 Jeff Garzik + * Copyright 2012-2014 pooler + * Copyright 2014 Lucas Jones + * Copyright 2014-2016 Wolf9466 + * Copyright 2016 Jay D Dee + * Copyright 2017-2018 XMR-Stak , + * Copyright 2018 Lee Clagett + * Copyright 2016-2018 XMRig , + * + * 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 . + */ + +#ifndef __ALGORITHM_H__ +#define __ALGORITHM_H__ + + +#include "common/xmrig.h" + + +namespace xmrig { + + +class Algorithm +{ +public: + inline Algorithm() : + m_algo(INVALID_ALGO), + m_variant(VARIANT_AUTO) + {} + + inline Algorithm(Algo algo, Variant variant) : + m_variant(variant) + { + setAlgo(algo); + } + + bool isEqual(const Algorithm &other) const { return m_algo == other.m_algo && m_variant == other.m_variant; } + inline Algo algo() const { return m_algo; } + inline bool isValid() const { return m_algo != INVALID_ALGO; } + inline const char *name() const { return name(false); } + inline const char *shortName() const { return name(true); } + inline Variant variant() const { return m_variant; } + inline void setVariant(Variant variant) { m_variant = variant; } + + inline bool operator!=(const Algorithm &other) const { return !isEqual(other); } + inline bool operator==(const Algorithm &other) const { return isEqual(other); } + + const char *variantName() const; + void parseAlgorithm(const char *algo); + void parseVariant(const char *variant); + void parseVariant(int variant); + void setAlgo(Algo algo); + +private: + const char *name(bool shortName) const; + + Algo m_algo; + Variant m_variant; +}; + + +} /* namespace xmrig */ + +#endif /* __ALGORITHM_H__ */ diff --git a/src/common/net/Client.cpp b/src/common/net/Client.cpp index de56b315b..0576854bd 100644 --- a/src/common/net/Client.cpp +++ b/src/common/net/Client.cpp @@ -232,7 +232,7 @@ bool Client::parseJob(const rapidjson::Value ¶ms, int *code) return false; } - Job job(m_id, m_nicehash, m_pool.algorithm(), m_pool.variant(), m_rpcId); + Job job(m_id, m_nicehash, m_pool.algorithm(), m_rpcId); if (!job.setId(params["job_id"].GetString())) { *code = 3; @@ -250,7 +250,7 @@ bool Client::parseJob(const rapidjson::Value ¶ms, int *code) } if (params.HasMember("variant")) { - job.setVariant(params["variant"].GetInt()); + job.algorithm().parseVariant(params["variant"].GetInt()); } if (m_job != job) { diff --git a/src/common/net/Job.cpp b/src/common/net/Job.cpp index ec5279bfe..34aab3262 100644 --- a/src/common/net/Job.cpp +++ b/src/common/net/Job.cpp @@ -64,14 +64,12 @@ Job::Job() : m_size(0), m_diff(0), m_target(0), - m_blob(), - m_algorithm(xmrig::INVALID_ALGO), - m_variant(xmrig::VARIANT_AUTO) + m_blob() { } -Job::Job(int poolId, bool nicehash, xmrig::Algo algo, xmrig::Variant variant, const xmrig::Id &clientId) : +Job::Job(int poolId, bool nicehash, xmrig::Algorithm algorithm, const xmrig::Id &clientId) : m_nicehash(nicehash), m_poolId(poolId), m_threadId(-1), @@ -79,9 +77,8 @@ Job::Job(int poolId, bool nicehash, xmrig::Algo algo, xmrig::Variant variant, co m_diff(0), m_target(0), m_blob(), - m_algorithm(algo), - m_clientId(clientId), - m_variant(variant) + m_algorithm(algorithm), + m_clientId(clientId) { } @@ -166,23 +163,6 @@ bool Job::setTarget(const char *target) } -void Job::setVariant(int variant) -{ - switch (variant) { - case xmrig::VARIANT_AUTO: - case xmrig::VARIANT_V0: - case xmrig::VARIANT_V1: - m_variant = static_cast(variant); - break; - - default: - assert(false); - m_variant = xmrig::VARIANT_AUTO; - break; - } -} - - bool Job::fromHex(const char* in, unsigned int len, unsigned char* out) { bool error = false; diff --git a/src/common/net/Job.h b/src/common/net/Job.h index c235072e8..08d5ae82b 100644 --- a/src/common/net/Job.h +++ b/src/common/net/Job.h @@ -30,40 +30,44 @@ #include +#include "common/crypto/Algorithm.h" #include "common/net/Id.h" -#include "common/xmrig.h" class Job { public: Job(); - Job(int poolId, bool nicehash, xmrig::Algo algo, xmrig::Variant variant, const xmrig::Id &clientId); + Job(int poolId, bool nicehash, xmrig::Algorithm algorithm, const xmrig::Id &clientId); ~Job(); bool setBlob(const char *blob); bool setTarget(const char *target); - void setVariant(int variant); - inline bool isNicehash() const { return m_nicehash; } - inline bool isValid() const { return m_size > 0 && m_diff > 0; } - inline bool setId(const char *id) { return m_id.setId(id); } - inline const uint32_t *nonce() const { return reinterpret_cast(m_blob + 39); } - inline const uint8_t *blob() const { return m_blob; } - inline const xmrig::Id &clientId() const { return m_clientId; } - inline const xmrig::Id &id() const { return m_id; } - inline int poolId() const { return m_poolId; } - inline int threadId() const { return m_threadId; } - inline size_t size() const { return m_size; } - inline uint32_t *nonce() { return reinterpret_cast(m_blob + 39); } - inline uint32_t diff() const { return static_cast(m_diff); } - inline uint64_t target() const { return m_target; } - inline void reset() { m_size = 0; m_diff = 0; } - inline void setClientId(const xmrig::Id &id) { m_clientId = id; } - inline void setPoolId(int poolId) { m_poolId = poolId; } - inline void setThreadId(int threadId) { m_threadId = threadId; } - inline xmrig::Algo algorithm() const { return m_algorithm; } - inline xmrig::Variant variant() const { return (m_variant == xmrig::VARIANT_AUTO ? (m_blob[0] > 6 ? xmrig::VARIANT_V1 : xmrig::VARIANT_V0) : m_variant); } + inline bool isNicehash() const { return m_nicehash; } + inline bool isValid() const { return m_size > 0 && m_diff > 0; } + inline bool setId(const char *id) { return m_id.setId(id); } + inline const uint32_t *nonce() const { return reinterpret_cast(m_blob + 39); } + inline const uint8_t *blob() const { return m_blob; } + inline const xmrig::Algorithm &algorithm() const { return m_algorithm; } + inline const xmrig::Id &clientId() const { return m_clientId; } + inline const xmrig::Id &id() const { return m_id; } + inline int poolId() const { return m_poolId; } + inline int threadId() const { return m_threadId; } + inline size_t size() const { return m_size; } + inline uint32_t *nonce() { return reinterpret_cast(m_blob + 39); } + inline uint32_t diff() const { return static_cast(m_diff); } + inline uint64_t target() const { return m_target; } + inline void reset() { m_size = 0; m_diff = 0; } + inline void setClientId(const xmrig::Id &id) { m_clientId = id; } + inline void setPoolId(int poolId) { m_poolId = poolId; } + inline void setThreadId(int threadId) { m_threadId = threadId; } + inline xmrig::Algorithm &algorithm() { return m_algorithm; } + + inline xmrig::Variant variant() const + { + return (m_algorithm.variant() == xmrig::VARIANT_AUTO ? (m_blob[0] > 6 ? xmrig::VARIANT_1 : xmrig::VARIANT_0) : m_algorithm.variant()); + } # ifdef XMRIG_PROXY_PROJECT inline char *rawBlob() { return m_rawBlob; } @@ -90,10 +94,9 @@ private: uint64_t m_diff; uint64_t m_target; uint8_t m_blob[96]; // Max blob size is 84 (75 fixed + 9 variable), aligned to 96. https://github.com/xmrig/xmrig/issues/1 Thanks fireice-uk. - xmrig::Algo m_algorithm; + xmrig::Algorithm m_algorithm; xmrig::Id m_clientId; xmrig::Id m_id; - xmrig::Variant m_variant; # ifdef XMRIG_PROXY_PROJECT char m_rawBlob[176]; diff --git a/src/common/net/Pool.cpp b/src/common/net/Pool.cpp index 4675876ad..d3c150569 100644 --- a/src/common/net/Pool.cpp +++ b/src/common/net/Pool.cpp @@ -29,6 +29,7 @@ #include "common/net/Pool.h" +#include "rapidjson/document.h" #ifdef APP_DEBUG @@ -42,52 +43,10 @@ #endif -static const char *algoNames[] = { - "cryptonight", -# ifndef XMRIG_NO_AEON - "cryptonight-lite", -# else - nullptr, -# endif -# ifndef XMRIG_NO_SUMO - "cryptonight-heavy", -# else - nullptr, -# endif -# ifndef XMRIG_NO_IPBC - "cryptonight-ipbc", -# else - nullptr, -# endif -}; - - -static const char *algoNamesShort[] = { - "cn", -# ifndef XMRIG_NO_AEON - "cn-lite", -# else - nullptr, -# endif -# ifndef XMRIG_NO_SUMO - "cn-heavy", -# else - nullptr, -# endif -# ifndef XMRIG_NO_IPBC - "cn-ipbc", -# else - nullptr, -# endif -}; - - Pool::Pool() : m_nicehash(false), m_keepAlive(0), - m_port(kDefaultPort), - m_algorithm(xmrig::INVALID_ALGO), - m_variant(xmrig::VARIANT_AUTO) + m_port(kDefaultPort) { } @@ -106,23 +65,19 @@ Pool::Pool() : Pool::Pool(const char *url) : m_nicehash(false), m_keepAlive(0), - m_port(kDefaultPort), - m_algorithm(xmrig::INVALID_ALGO), - m_variant(xmrig::VARIANT_AUTO) + m_port(kDefaultPort) { parse(url); } -Pool::Pool(const char *host, uint16_t port, const char *user, const char *password, int keepAlive, bool nicehash, xmrig::Variant variant) : +Pool::Pool(const char *host, uint16_t port, const char *user, const char *password, int keepAlive, bool nicehash) : m_nicehash(nicehash), m_keepAlive(keepAlive), m_port(port), - m_algorithm(xmrig::INVALID_ALGO), m_host(host), m_password(password), - m_user(user), - m_variant(variant) + m_user(user) { const size_t size = m_host.size() + 8; assert(size > 8); @@ -134,41 +89,6 @@ Pool::Pool(const char *host, uint16_t port, const char *user, const char *passwo } -const char *Pool::algoName(xmrig::Algo algorithm, bool shortName) -{ - if (algorithm == xmrig::INVALID_ALGO) { - return "invalid"; - } - - return (shortName ? algoNamesShort : algoNames)[algorithm]; -} - - -xmrig::Algo Pool::algorithm(const char *algo) -{ -# ifndef XMRIG_NO_AEON - if (strcasecmp(algo, "cryptonight-light") == 0) { - fprintf(stderr, "Algorithm \"cryptonight-light\" is deprecated, use \"cryptonight-lite\" instead\n"); - - return xmrig::CRYPTONIGHT_LITE; - } -# endif - - const size_t size = sizeof(algoNames) / sizeof(algoNames[0]); - - assert(size == (sizeof(algoNamesShort) / sizeof(algoNamesShort[0]))); - - for (size_t i = 0; i < size; i++) { - if ((algoNames[i] && strcasecmp(algo, algoNames[i]) == 0) || (algoNamesShort[i] && strcasecmp(algo, algoNamesShort[i]) == 0)) { - return static_cast(i); - } - } - - fprintf(stderr, "Unknown algorithm \"%s\" specified.\n", algo); - return xmrig::INVALID_ALGO; -} - - bool Pool::isEqual(const Pool &other) const { return (m_nicehash == other.m_nicehash @@ -179,8 +99,7 @@ bool Pool::isEqual(const Pool &other) const && m_password == other.m_password && m_rigId == other.m_rigId && m_url == other.m_url - && m_user == other.m_user - && m_variant == other.m_variant); + && m_user == other.m_user); } @@ -242,14 +161,54 @@ bool Pool::setUserpass(const char *userpass) } +rapidjson::Value Pool::toJSON(rapidjson::Document &doc) const +{ + using namespace rapidjson; + + auto &allocator = doc.GetAllocator(); + + Value obj(kObjectType); + + obj.AddMember("url", StringRef(url()), allocator); + obj.AddMember("user", StringRef(user()), allocator); + obj.AddMember("pass", StringRef(password()), allocator); + obj.AddMember("rig-id", rigId() ? Value(StringRef(rigId())).Move() : Value(kNullType).Move(), allocator); + +# ifndef XMRIG_PROXY_PROJECT + obj.AddMember("nicehash", isNicehash(), allocator); +# endif + + if (m_keepAlive == 0 || m_keepAlive == kKeepAliveTimeout) { + obj.AddMember("keepalive", m_keepAlive > 0, allocator); + } + else { + obj.AddMember("keepalive", m_keepAlive, allocator); + } + + switch (m_algorithm.variant()) { + case xmrig::VARIANT_AUTO: + case xmrig::VARIANT_0: + case xmrig::VARIANT_1: + obj.AddMember("variant", m_algorithm.variant(), allocator); + break; + + default: + obj.AddMember("variant", StringRef(m_algorithm.variantName()), allocator); + break; + } + + return obj; +} + + void Pool::adjust(xmrig::Algo algorithm) { if (!isValid()) { return; } - if (m_algorithm == xmrig::INVALID_ALGO) { - m_algorithm = algorithm; + if (!m_algorithm.isValid()) { + m_algorithm.setAlgo(algorithm); } if (strstr(m_host.data(), ".nicehash.com")) { @@ -257,50 +216,17 @@ void Pool::adjust(xmrig::Algo algorithm) m_nicehash = true; if (strstr(m_host.data(), "cryptonightv7.")) { - m_variant = xmrig::VARIANT_V1; + m_algorithm.setVariant(xmrig::VARIANT_1); } } if (strstr(m_host.data(), ".minergate.com")) { - m_variant = xmrig::VARIANT_V1; m_keepAlive = false; + m_algorithm.setVariant(xmrig::VARIANT_1); } } -void Pool::setVariant(int variant) -{ - switch (variant) { - case xmrig::VARIANT_AUTO: - case xmrig::VARIANT_V0: - case xmrig::VARIANT_V1: - m_variant = static_cast(variant); - break; - - default: - assert(false); - break; - } -} - - -xmrig::Variant Pool::variant() const -{ - switch (m_algorithm) { - case xmrig::CRYPTONIGHT_HEAVY: - return xmrig::VARIANT_V0; - - case xmrig::CRYPTONIGHT_IPBC: - return xmrig::VARIANT_V1; - - default: - break; - } - - return m_variant; -} - - #ifdef APP_DEBUG void Pool::print() const { @@ -309,8 +235,8 @@ void Pool::print() const LOG_DEBUG ("port: %d", static_cast(m_port)); LOG_DEBUG ("user: %s", m_user.data()); LOG_DEBUG ("pass: %s", m_password.data()); - LOG_DEBUG ("rig_id %s", m_rigId.data()); - LOG_DEBUG ("algo: %s/%d", algoName(m_algorithm), static_cast(variant())); + LOG_DEBUG ("rig-id %s", m_rigId.data()); + LOG_DEBUG ("algo: %s", m_algorithm.name()); LOG_DEBUG ("nicehash: %d", static_cast(m_nicehash)); LOG_DEBUG ("keepAlive: %d", m_keepAlive); } diff --git a/src/common/net/Pool.h b/src/common/net/Pool.h index b1b935074..670924f27 100644 --- a/src/common/net/Pool.h +++ b/src/common/net/Pool.h @@ -28,8 +28,9 @@ #include +#include "common/crypto/Algorithm.h" #include "common/utils/c_str.h" -#include "common/xmrig.h" +#include "rapidjson/fwd.h" class Pool @@ -47,30 +48,25 @@ public: const char *user = nullptr, const char *password = nullptr, int keepAlive = 0, - bool nicehash = false, - xmrig::Variant variant = xmrig::VARIANT_AUTO + bool nicehash = false ); - static const char *algoName(xmrig::Algo algorithm, bool shortName = false); - static xmrig::Algo algorithm(const char *algo); - - inline bool isNicehash() const { return m_nicehash; } - inline bool isValid() const { return !m_host.isNull() && m_port > 0; } - inline const char *host() const { return m_host.data(); } - inline const char *password() const { return !m_password.isNull() ? m_password.data() : kDefaultPassword; } - inline const char *rigId() const { return m_rigId.data(); } - inline const char *url() const { return m_url.data(); } - inline const char *user() const { return !m_user.isNull() ? m_user.data() : kDefaultUser; } - inline int keepAlive() const { return m_keepAlive; } - inline uint16_t port() const { return m_port; } - inline void setAlgo(const char *algo) { m_algorithm = algorithm(algo); } - inline void setAlgo(xmrig::Algo algorithm) { m_algorithm = algorithm; } - inline void setKeepAlive(int keepAlive) { m_keepAlive = keepAlive >= 0 ? keepAlive : 0; } - inline void setNicehash(bool nicehash) { m_nicehash = nicehash; } - inline void setPassword(const char *password) { m_password = password; } - inline void setRigId(const char *rigId) { m_rigId = rigId; } - inline void setUser(const char *user) { m_user = user; } - inline xmrig::Algo algorithm() const { return m_algorithm; } + inline bool isNicehash() const { return m_nicehash; } + inline bool isValid() const { return !m_host.isNull() && m_port > 0; } + inline const char *host() const { return m_host.data(); } + inline const char *password() const { return !m_password.isNull() ? m_password.data() : kDefaultPassword; } + inline const char *rigId() const { return m_rigId.data(); } + inline const char *url() const { return m_url.data(); } + inline const char *user() const { return !m_user.isNull() ? m_user.data() : kDefaultUser; } + inline const xmrig::Algorithm &algorithm() const { return m_algorithm; } + inline int keepAlive() const { return m_keepAlive; } + inline uint16_t port() const { return m_port; } + inline void setKeepAlive(int keepAlive) { m_keepAlive = keepAlive >= 0 ? keepAlive : 0; } + inline void setNicehash(bool nicehash) { m_nicehash = nicehash; } + inline void setPassword(const char *password) { m_password = password; } + inline void setRigId(const char *rigId) { m_rigId = rigId; } + inline void setUser(const char *user) { m_user = user; } + inline xmrig::Algorithm &algorithm() { return m_algorithm; } inline bool operator!=(const Pool &other) const { return !isEqual(other); } inline bool operator==(const Pool &other) const { return isEqual(other); } @@ -78,9 +74,8 @@ public: bool isEqual(const Pool &other) const; bool parse(const char *url); bool setUserpass(const char *userpass); + rapidjson::Value toJSON(rapidjson::Document &doc) const; void adjust(xmrig::Algo algorithm); - void setVariant(int variant); - xmrig::Variant variant() const; # ifdef APP_DEBUG void print() const; @@ -92,13 +87,12 @@ private: bool m_nicehash; int m_keepAlive; uint16_t m_port; - xmrig::Algo m_algorithm; + xmrig::Algorithm m_algorithm; xmrig::c_str m_host; xmrig::c_str m_password; xmrig::c_str m_rigId; xmrig::c_str m_url; xmrig::c_str m_user; - xmrig::Variant m_variant; }; #endif /* __POOL_H__ */ diff --git a/src/common/net/Storage.h b/src/common/net/Storage.h index 752e9512b..f36ce5946 100644 --- a/src/common/net/Storage.h +++ b/src/common/net/Storage.h @@ -29,9 +29,6 @@ #include -#include "common/log/Log.h" - - namespace xmrig { diff --git a/src/common/utils/c_str.h b/src/common/utils/c_str.h index 9a11ade64..3cc4d3261 100644 --- a/src/common/utils/c_str.h +++ b/src/common/utils/c_str.h @@ -68,7 +68,7 @@ public: inline bool isEqual(const char *str) const { - return (m_data != nullptr && str != nullptr && strcmp(m_data, str)) || (m_data == nullptr && m_data == nullptr); + return (m_data != nullptr && str != nullptr && strcmp(m_data, str) == 0) || (m_data == nullptr && m_data == nullptr); } diff --git a/src/common/xmrig.h b/src/common/xmrig.h index 2de1a798f..3349d3b66 100644 --- a/src/common/xmrig.h +++ b/src/common/xmrig.h @@ -33,8 +33,7 @@ enum Algo { INVALID_ALGO = -1, CRYPTONIGHT, /* CryptoNight (Monero) */ CRYPTONIGHT_LITE, /* CryptoNight-Lite (AEON) */ - CRYPTONIGHT_HEAVY, /* CryptoNight-Heavy (SUMO) */ - CRYPTONIGHT_IPBC /* CryptoNight-IPBC (IPBC) */ + CRYPTONIGHT_HEAVY /* CryptoNight-Heavy (SUMO) */ }; @@ -60,8 +59,10 @@ enum AlgoVariant { enum Variant { VARIANT_AUTO = -1, // Autodetect - VARIANT_V0 = 0, // Original CryptoNight or CryptoNight-Heavy - VARIANT_V1 = 1 // Monero v7 PoW + VARIANT_0 = 0, // Original CryptoNight or CryptoNight-Heavy + VARIANT_1 = 1, // CryptoNight variant 1 also known as Monero7 and CryptoNightV7 + VARIANT_IBPC = 2, // CryptoNight Lite variant 1 with XOR (IPBC only) + VARIANT_XTL = 3 // CryptoNight variant 1 (Stellite only) }; diff --git a/src/core/Config.cpp b/src/core/Config.cpp index 43abbbbdf..329d595a3 100644 --- a/src/core/Config.cpp +++ b/src/core/Config.cpp @@ -71,7 +71,7 @@ void xmrig::Config::getJSON(rapidjson::Document &doc) const auto &allocator = doc.GetAllocator(); - doc.AddMember("algo", StringRef(algoName()), allocator); + doc.AddMember("algo", StringRef(algorithm().name()), allocator); Value api(kObjectType); api.AddMember("port", apiPort(), allocator); @@ -103,24 +103,7 @@ void xmrig::Config::getJSON(rapidjson::Document &doc) const Value pools(kArrayType); for (const Pool &pool : m_pools) { - Value obj(kObjectType); - - obj.AddMember("url", StringRef(pool.url()), allocator); - obj.AddMember("user", StringRef(pool.user()), allocator); - obj.AddMember("pass", StringRef(pool.password()), allocator); - obj.AddMember("rig-id", pool.rigId() ? Value(StringRef(pool.rigId())).Move() : Value(kNullType).Move(), allocator); - - if (pool.keepAlive() == 0 || pool.keepAlive() == Pool::kKeepAliveTimeout) { - obj.AddMember("keepalive", pool.keepAlive() > 0, allocator); - } - else { - obj.AddMember("keepalive", pool.keepAlive(), allocator); - } - - obj.AddMember("nicehash", pool.isNicehash(), allocator); - obj.AddMember("variant", pool.variant(), allocator); - - pools.PushBack(obj, allocator); + pools.PushBack(pool.toJSON(doc), allocator); } doc.AddMember("pools", pools, allocator); @@ -169,7 +152,7 @@ bool xmrig::Config::adjust() const bool softAES = (m_aesMode == AES_AUTO ? (Cpu::hasAES() ? AES_HW : AES_SOFT) : m_aesMode) == AES_SOFT; for (size_t i = 0; i < m_threads.cpu.size(); ++i) { - m_threads.list.push_back(CpuThread::createFromData(i, m_algorithm, m_threads.cpu[i], m_priority, softAES)); + m_threads.list.push_back(CpuThread::createFromData(i, m_algorithm.algo(), m_threads.cpu[i], m_priority, softAES)); } return true; @@ -178,7 +161,7 @@ bool xmrig::Config::adjust() m_algoVariant = getAlgoVariant(); m_threads.mode = m_threads.count ? Simple : Automatic; - const size_t size = CpuThread::multiway(m_algoVariant) * cn_select_memory(m_algorithm) / 1024; + const size_t size = CpuThread::multiway(m_algoVariant) * cn_select_memory(m_algorithm.algo()) / 1024; if (!m_threads.count) { m_threads.count = Cpu::optimalThreadsCount(size, m_maxCpuUsage); @@ -191,7 +174,7 @@ bool xmrig::Config::adjust() } for (size_t i = 0; i < m_threads.count; ++i) { - m_threads.list.push_back(CpuThread::createFromAV(i, m_algorithm, m_algoVariant, m_threads.mask, m_priority)); + m_threads.list.push_back(CpuThread::createFromAV(i, m_algorithm.algo(), m_algoVariant, m_threads.mask, m_priority)); } return true; @@ -351,7 +334,7 @@ bool xmrig::Config::parseInt(int key, int arg) xmrig::AlgoVariant xmrig::Config::getAlgoVariant() const { # ifndef XMRIG_NO_AEON - if (m_algorithm == xmrig::CRYPTONIGHT_LITE) { + if (m_algorithm.algo() == xmrig::CRYPTONIGHT_LITE) { return getAlgoVariantLite(); } # endif diff --git a/src/crypto/CryptoNight_constants.h b/src/crypto/CryptoNight_constants.h index 6004edbd2..7e6627fd6 100644 --- a/src/crypto/CryptoNight_constants.h +++ b/src/crypto/CryptoNight_constants.h @@ -47,16 +47,12 @@ constexpr const size_t CRYPTONIGHT_HEAVY_MEMORY = 4 * 1024 * 1024; constexpr const uint32_t CRYPTONIGHT_HEAVY_MASK = 0x3FFFF0; constexpr const uint32_t CRYPTONIGHT_HEAVY_ITER = 0x40000; -constexpr const size_t CRYPTONIGHT_IPBC_MEMORY = 1 * 1024 * 1024; -constexpr const uint32_t CRYPTONIGHT_IPBC_MASK = 0xFFFF0; -constexpr const uint32_t CRYPTONIGHT_IPBC_ITER = 0x40000; - template inline constexpr size_t cn_select_memory() { return 0; } template<> inline constexpr size_t cn_select_memory() { return CRYPTONIGHT_MEMORY; } template<> inline constexpr size_t cn_select_memory() { return CRYPTONIGHT_LITE_MEMORY; } template<> inline constexpr size_t cn_select_memory() { return CRYPTONIGHT_HEAVY_MEMORY; } -template<> inline constexpr size_t cn_select_memory() { return CRYPTONIGHT_IPBC_MEMORY; } + inline size_t cn_select_memory(Algo algorithm) { @@ -71,9 +67,6 @@ inline size_t cn_select_memory(Algo algorithm) case CRYPTONIGHT_HEAVY: return CRYPTONIGHT_HEAVY_MEMORY; - case CRYPTONIGHT_IPBC: - return CRYPTONIGHT_IPBC_MEMORY; - default: break; } @@ -86,7 +79,7 @@ template inline constexpr uint32_t cn_select_mask() { retur template<> inline constexpr uint32_t cn_select_mask() { return CRYPTONIGHT_MASK; } template<> inline constexpr uint32_t cn_select_mask() { return CRYPTONIGHT_LITE_MASK; } template<> inline constexpr uint32_t cn_select_mask() { return CRYPTONIGHT_HEAVY_MASK; } -template<> inline constexpr uint32_t cn_select_mask() { return CRYPTONIGHT_IPBC_MASK; } + inline uint32_t cn_select_mask(Algo algorithm) { @@ -101,9 +94,6 @@ inline uint32_t cn_select_mask(Algo algorithm) case CRYPTONIGHT_HEAVY: return CRYPTONIGHT_HEAVY_MASK; - case CRYPTONIGHT_IPBC: - return CRYPTONIGHT_IPBC_MASK; - default: break; } @@ -116,7 +106,7 @@ template inline constexpr uint32_t cn_select_iter() { retur template<> inline constexpr uint32_t cn_select_iter() { return CRYPTONIGHT_ITER; } template<> inline constexpr uint32_t cn_select_iter() { return CRYPTONIGHT_LITE_ITER; } template<> inline constexpr uint32_t cn_select_iter() { return CRYPTONIGHT_HEAVY_ITER; } -template<> inline constexpr uint32_t cn_select_iter() { return CRYPTONIGHT_IPBC_ITER; } + inline uint32_t cn_select_iter(Algo algorithm) { @@ -131,9 +121,6 @@ inline uint32_t cn_select_iter(Algo algorithm) case CRYPTONIGHT_HEAVY: return CRYPTONIGHT_HEAVY_ITER; - case CRYPTONIGHT_IPBC: - return CRYPTONIGHT_IPBC_ITER; - default: break; } diff --git a/src/net/Network.cpp b/src/net/Network.cpp index 4101245e7..bcd13ee1d 100644 --- a/src/net/Network.cpp +++ b/src/net/Network.cpp @@ -61,7 +61,7 @@ Network::Network(xmrig::Controller *controller) : } if (controller->config()->donateLevel() > 0) { - m_donate = new DonateStrategy(controller->config()->donateLevel(), controller->config()->pools().front().user(), controller->config()->algorithm(), this); + m_donate = new DonateStrategy(controller->config()->donateLevel(), controller->config()->pools().front().user(), controller->config()->algorithm().algo(), this); } m_timer.data = this; @@ -166,9 +166,9 @@ bool Network::isColors() const void Network::setJob(Client *client, const Job &job, bool donate) { - LOG_INFO(isColors() ? MAGENTA_BOLD("new job") " from " WHITE_BOLD("%s:%d") " diff " WHITE_BOLD("%d") " algo " WHITE_BOLD("%s/%d") - : "new job from %s:%d diff %d algo %s/%d", - client->host(), client->port(), job.diff(), Pool::algoName(job.algorithm(), true), static_cast(job.variant())); + LOG_INFO(isColors() ? MAGENTA_BOLD("new job") " from " WHITE_BOLD("%s:%d") " diff " WHITE_BOLD("%d") " algo " WHITE_BOLD("%s") + : "new job from %s:%d diff %d algo %s", + client->host(), client->port(), job.diff(), job.algorithm().shortName()); m_state.diff = job.diff(); Workers::setJob(job, donate); diff --git a/src/net/strategies/DonateStrategy.cpp b/src/net/strategies/DonateStrategy.cpp index ad8e88c04..3bb5caa24 100644 --- a/src/net/strategies/DonateStrategy.cpp +++ b/src/net/strategies/DonateStrategy.cpp @@ -63,15 +63,12 @@ DonateStrategy::DonateStrategy(int level, const char *user, xmrig::Algo algo, IS else if (algo == xmrig::CRYPTONIGHT_HEAVY) { m_pools.push_back(Pool(kDonatePool1, 8888, userId, nullptr, false, true)); } - else if (algo == xmrig::CRYPTONIGHT_IPBC) { - m_pools.push_back(Pool(kDonatePool1, 13333, userId, nullptr, false, true)); - } else { m_pools.push_back(Pool(kDonatePool1, 5555, userId, nullptr, false, true)); } for (Pool &pool : m_pools) { - pool.setAlgo(algo); + pool.algorithm().setAlgo(algo); } if (m_pools.size() > 1) { diff --git a/src/workers/CpuThread.cpp b/src/workers/CpuThread.cpp index 5c0e8c0b0..758eb9825 100644 --- a/src/workers/CpuThread.cpp +++ b/src/workers/CpuThread.cpp @@ -62,69 +62,69 @@ bool xmrig::CpuThread::isSoftAES(AlgoVariant av) xmrig::CpuThread::cn_hash_fun xmrig::CpuThread::fn(Algo algorithm, AlgoVariant av, Variant variant) { - assert(variant == VARIANT_V0 || variant == VARIANT_V1); + assert(variant == VARIANT_0 || variant == VARIANT_1); static const cn_hash_fun func_table[50] = { - cryptonight_single_hash, - cryptonight_double_hash, - cryptonight_single_hash, - cryptonight_double_hash, - cryptonight_triple_hash, - cryptonight_quad_hash, - cryptonight_penta_hash, - cryptonight_triple_hash, - cryptonight_quad_hash, - cryptonight_penta_hash, + cryptonight_single_hash, + cryptonight_double_hash, + cryptonight_single_hash, + cryptonight_double_hash, + cryptonight_triple_hash, + cryptonight_quad_hash, + cryptonight_penta_hash, + cryptonight_triple_hash, + cryptonight_quad_hash, + cryptonight_penta_hash, - cryptonight_single_hash, - cryptonight_double_hash, - cryptonight_single_hash, - cryptonight_double_hash, - cryptonight_triple_hash, - cryptonight_quad_hash, - cryptonight_penta_hash, - cryptonight_triple_hash, - cryptonight_quad_hash, - cryptonight_penta_hash, + cryptonight_single_hash, + cryptonight_double_hash, + cryptonight_single_hash, + cryptonight_double_hash, + cryptonight_triple_hash, + cryptonight_quad_hash, + cryptonight_penta_hash, + cryptonight_triple_hash, + cryptonight_quad_hash, + cryptonight_penta_hash, # ifndef XMRIG_NO_AEON - cryptonight_single_hash, - cryptonight_double_hash, - cryptonight_single_hash, - cryptonight_double_hash, - cryptonight_triple_hash, - cryptonight_quad_hash, - cryptonight_penta_hash, - cryptonight_triple_hash, - cryptonight_quad_hash, - cryptonight_penta_hash, + cryptonight_single_hash, + cryptonight_double_hash, + cryptonight_single_hash, + cryptonight_double_hash, + cryptonight_triple_hash, + cryptonight_quad_hash, + cryptonight_penta_hash, + cryptonight_triple_hash, + cryptonight_quad_hash, + cryptonight_penta_hash, - cryptonight_single_hash, - cryptonight_double_hash, - cryptonight_single_hash, - cryptonight_double_hash, - cryptonight_triple_hash, - cryptonight_quad_hash, - cryptonight_penta_hash, - cryptonight_triple_hash, - cryptonight_quad_hash, - cryptonight_penta_hash, + cryptonight_single_hash, + cryptonight_double_hash, + cryptonight_single_hash, + cryptonight_double_hash, + cryptonight_triple_hash, + cryptonight_quad_hash, + cryptonight_penta_hash, + cryptonight_triple_hash, + cryptonight_quad_hash, + cryptonight_penta_hash, # else nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, # endif # ifndef XMRIG_NO_SUMO - cryptonight_single_hash, - cryptonight_double_hash, - cryptonight_single_hash, - cryptonight_double_hash, - cryptonight_triple_hash, - cryptonight_quad_hash, - cryptonight_penta_hash, - cryptonight_triple_hash, - cryptonight_quad_hash, - cryptonight_penta_hash, + cryptonight_single_hash, + cryptonight_double_hash, + cryptonight_single_hash, + cryptonight_double_hash, + cryptonight_triple_hash, + cryptonight_quad_hash, + cryptonight_penta_hash, + cryptonight_triple_hash, + cryptonight_quad_hash, + cryptonight_penta_hash, # else nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, # endif @@ -132,7 +132,7 @@ xmrig::CpuThread::cn_hash_fun xmrig::CpuThread::fn(Algo algorithm, AlgoVariant a # ifndef XMRIG_NO_SUMO if (algorithm == CRYPTONIGHT_HEAVY) { - variant = VARIANT_V0; + variant = VARIANT_0; } # endif @@ -252,7 +252,6 @@ rapidjson::Value xmrig::CpuThread::toAPI(rapidjson::Document &doc) const auto &allocator = doc.GetAllocator(); obj.AddMember("type", "cpu", allocator); - obj.AddMember("algo", rapidjson::StringRef(Pool::algoName(algorithm())), allocator); obj.AddMember("av", m_av, allocator); obj.AddMember("low_power_mode", multiway(), allocator); obj.AddMember("affine_to_cpu", affinity(), allocator); diff --git a/src/workers/MultiWorker.cpp b/src/workers/MultiWorker.cpp index 33f5864d9..c3cd9782b 100644 --- a/src/workers/MultiWorker.cpp +++ b/src/workers/MultiWorker.cpp @@ -50,21 +50,21 @@ MultiWorker::~MultiWorker() template bool MultiWorker::selfTest() { - if (m_thread->fn(xmrig::VARIANT_V0) == nullptr) { + if (m_thread->fn(xmrig::VARIANT_0) == nullptr) { return false; } - m_thread->fn(xmrig::VARIANT_V0)(test_input, 76, m_hash, m_ctx); + m_thread->fn(xmrig::VARIANT_0)(test_input, 76, m_hash, m_ctx); if (m_thread->algorithm() == xmrig::CRYPTONIGHT && memcmp(m_hash, test_output_v0, sizeof m_hash) == 0) { - m_thread->fn(xmrig::VARIANT_V1)(test_input, 76, m_hash, m_ctx); + m_thread->fn(xmrig::VARIANT_1)(test_input, 76, m_hash, m_ctx); return memcmp(m_hash, test_output_v1, sizeof m_hash) == 0; } # ifndef XMRIG_NO_AEON if (m_thread->algorithm() == xmrig::CRYPTONIGHT_LITE && memcmp(m_hash, test_output_v0_lite, sizeof m_hash) == 0) { - m_thread->fn(xmrig::VARIANT_V1)(test_input, 76, m_hash, m_ctx); + m_thread->fn(xmrig::VARIANT_1)(test_input, 76, m_hash, m_ctx); return memcmp(m_hash, test_output_v1_lite, sizeof m_hash) == 0; } diff --git a/src/workers/Workers.cpp b/src/workers/Workers.cpp index 67b2973db..497e30606 100644 --- a/src/workers/Workers.cpp +++ b/src/workers/Workers.cpp @@ -132,7 +132,7 @@ void Workers::setJob(const Job &job, bool donate) void Workers::start(xmrig::Controller *controller) { const std::vector &threads = controller->config()->threads(); - m_status.algo = controller->config()->algorithm(); + m_status.algo = controller->config()->algorithm().algo(); m_status.colors = controller->config()->isColors(); m_status.threads = threads.size();