Prepare for per pool and per job algorithms.

This commit is contained in:
XMRig 2018-04-21 19:55:51 +07:00
parent 274992e50d
commit 45e8a0525c
14 changed files with 116 additions and 84 deletions

View file

@ -141,7 +141,7 @@ bool xmrig::CommonConfig::parseString(int key, const char *arg)
{ {
switch (key) { switch (key) {
case AlgorithmKey: /* --algo */ case AlgorithmKey: /* --algo */
setAlgo(arg); m_algorithm = Pool::algorithm(arg);
break; break;
case UserpassKey: /* --userpass */ case UserpassKey: /* --userpass */
@ -204,7 +204,7 @@ bool xmrig::CommonConfig::parseString(int key, const char *arg)
case SyslogKey: /* --syslog */ case SyslogKey: /* --syslog */
case KeepAliveKey: /* --keepalive */ case KeepAliveKey: /* --keepalive */
case NicehashKey: /* --nicehash */ case NicehashKey: /* --nicehash */
case ApiIPv6Key: /* --api-ipv6 */ case ApiIPv6Key: /* --api-ipv6 */
return parseBoolean(key, true); return parseBoolean(key, true);
case ColorKey: /* --no-color */ case ColorKey: /* --no-color */
@ -322,9 +322,3 @@ bool xmrig::CommonConfig::parseInt(int key, int arg)
return true; return true;
} }
void xmrig::CommonConfig::setAlgo(const char *algo)
{
m_algorithm = Pool::algorithm(algo);
}

View file

@ -96,7 +96,6 @@ protected:
private: private:
bool parseInt(int key, int arg); bool parseInt(int key, int arg);
void setAlgo(const char *algo);
}; };

View file

@ -80,6 +80,12 @@ private:
}; };
#define MAGENTA_BOLD(x) "\e[1;35m" x "\e[0m"
#define MAGENTA(x) "\e[0;35m" x "\e[0m"
#define WHITE_BOLD(x) "\e[1;37m" x "\e[0m"
#define WHITE(x) "\e[0;37m" x "\e[0m"
#define LOG_ERR(x, ...) Log::i()->message(Log::ERR, x, ##__VA_ARGS__) #define LOG_ERR(x, ...) Log::i()->message(Log::ERR, x, ##__VA_ARGS__)
#define LOG_WARN(x, ...) Log::i()->message(Log::WARNING, x, ##__VA_ARGS__) #define LOG_WARN(x, ...) Log::i()->message(Log::WARNING, x, ##__VA_ARGS__)
#define LOG_NOTICE(x, ...) Log::i()->message(Log::NOTICE, x, ##__VA_ARGS__) #define LOG_NOTICE(x, ...) Log::i()->message(Log::NOTICE, x, ##__VA_ARGS__)

View file

@ -232,7 +232,7 @@ bool Client::parseJob(const rapidjson::Value &params, int *code)
return false; return false;
} }
Job job(m_id, m_nicehash, m_pool.algo(), m_pool.variant(), m_rpcId); Job job(m_id, m_nicehash, m_pool.algorithm(), m_pool.variant(), m_rpcId);
if (!job.setId(params["job_id"].GetString())) { if (!job.setId(params["job_id"].GetString())) {
*code = 3; *code = 3;

View file

@ -65,7 +65,7 @@ Job::Job() :
m_diff(0), m_diff(0),
m_target(0), m_target(0),
m_blob(), m_blob(),
m_algo(xmrig::INVALID_ALGO), m_algorithm(xmrig::INVALID_ALGO),
m_variant(xmrig::VARIANT_AUTO) m_variant(xmrig::VARIANT_AUTO)
{ {
} }
@ -79,7 +79,7 @@ Job::Job(int poolId, bool nicehash, xmrig::Algo algo, xmrig::Variant variant, co
m_diff(0), m_diff(0),
m_target(0), m_target(0),
m_blob(), m_blob(),
m_algo(algo), m_algorithm(algo),
m_clientId(clientId), m_clientId(clientId),
m_variant(variant) m_variant(variant)
{ {
@ -170,7 +170,7 @@ void Job::setVariant(int variant)
{ {
switch (variant) { switch (variant) {
case xmrig::VARIANT_AUTO: case xmrig::VARIANT_AUTO:
case xmrig::VARIANT_NONE: case xmrig::VARIANT_V0:
case xmrig::VARIANT_V1: case xmrig::VARIANT_V1:
m_variant = static_cast<xmrig::Variant>(variant); m_variant = static_cast<xmrig::Variant>(variant);
break; break;

View file

@ -61,7 +61,8 @@ public:
inline void setClientId(const xmrig::Id &id) { m_clientId = id; } inline void setClientId(const xmrig::Id &id) { m_clientId = id; }
inline void setPoolId(int poolId) { m_poolId = poolId; } inline void setPoolId(int poolId) { m_poolId = poolId; }
inline void setThreadId(int threadId) { m_threadId = threadId; } inline void setThreadId(int threadId) { m_threadId = threadId; }
inline xmrig::Variant variant() const { return (m_variant == xmrig::VARIANT_AUTO ? (m_blob[0] > 6 ? xmrig::VARIANT_V1 : xmrig::VARIANT_NONE) : m_variant); } 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); }
# ifdef XMRIG_PROXY_PROJECT # ifdef XMRIG_PROXY_PROJECT
inline char *rawBlob() { return m_rawBlob; } inline char *rawBlob() { return m_rawBlob; }
@ -88,7 +89,7 @@ private:
uint64_t m_diff; uint64_t m_diff;
uint64_t m_target; 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. 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_algo; xmrig::Algo m_algorithm;
xmrig::Id m_clientId; xmrig::Id m_clientId;
xmrig::Id m_id; xmrig::Id m_id;
xmrig::Variant m_variant; xmrig::Variant m_variant;

View file

@ -81,7 +81,7 @@ Pool::Pool() :
m_nicehash(false), m_nicehash(false),
m_keepAlive(0), m_keepAlive(0),
m_port(kDefaultPort), m_port(kDefaultPort),
m_algo(xmrig::CRYPTONIGHT), m_algorithm(xmrig::INVALID_ALGO),
m_variant(xmrig::VARIANT_AUTO) m_variant(xmrig::VARIANT_AUTO)
{ {
} }
@ -102,7 +102,7 @@ Pool::Pool(const char *url) :
m_nicehash(false), m_nicehash(false),
m_keepAlive(0), m_keepAlive(0),
m_port(kDefaultPort), m_port(kDefaultPort),
m_algo(xmrig::CRYPTONIGHT), m_algorithm(xmrig::INVALID_ALGO),
m_variant(xmrig::VARIANT_AUTO) m_variant(xmrig::VARIANT_AUTO)
{ {
parse(url); parse(url);
@ -113,11 +113,11 @@ Pool::Pool(const char *host, uint16_t port, const char *user, const char *passwo
m_nicehash(nicehash), m_nicehash(nicehash),
m_keepAlive(keepAlive), m_keepAlive(keepAlive),
m_port(port), m_port(port),
m_algo(xmrig::CRYPTONIGHT), m_algorithm(xmrig::INVALID_ALGO),
m_host(host), m_host(host),
m_password(password), m_password(password),
m_user(user), m_user(user),
m_variant(variant) m_variant(variant)
{ {
const size_t size = m_host.size() + 8; const size_t size = m_host.size() + 8;
assert(size > 8); assert(size > 8);
@ -131,6 +131,10 @@ Pool::Pool(const char *host, uint16_t port, const char *user, const char *passwo
const char *Pool::algoName(xmrig::Algo algorithm, bool shortName) const char *Pool::algoName(xmrig::Algo algorithm, bool shortName)
{ {
if (algorithm == xmrig::INVALID_ALGO) {
return "invalid";
}
return (shortName ? algoNamesShort : algoNames)[algorithm]; return (shortName ? algoNamesShort : algoNames)[algorithm];
} }
@ -160,6 +164,20 @@ xmrig::Algo Pool::algorithm(const char *algo)
} }
bool Pool::isEqual(const Pool &other) const
{
return (m_nicehash == other.m_nicehash
&& m_keepAlive == other.m_keepAlive
&& m_port == other.m_port
&& m_algorithm == other.m_algorithm
&& m_host == other.m_host
&& m_password == other.m_password
&& m_url == other.m_url
&& m_user == other.m_user
&& m_variant == other.m_variant);
}
bool Pool::parse(const char *url) bool Pool::parse(const char *url)
{ {
assert(url != nullptr); assert(url != nullptr);
@ -218,13 +236,15 @@ bool Pool::setUserpass(const char *userpass)
} }
void Pool::adjust(xmrig::Algo algo) void Pool::adjust(xmrig::Algo algorithm)
{ {
if (!isValid()) { if (!isValid()) {
return; return;
} }
m_algo = algo; if (m_algorithm == xmrig::INVALID_ALGO) {
m_algorithm = algorithm;
}
if (strstr(m_host.data(), ".nicehash.com")) { if (strstr(m_host.data(), ".nicehash.com")) {
m_keepAlive = false; m_keepAlive = false;
@ -241,7 +261,7 @@ void Pool::setVariant(int variant)
{ {
switch (variant) { switch (variant) {
case xmrig::VARIANT_AUTO: case xmrig::VARIANT_AUTO:
case xmrig::VARIANT_NONE: case xmrig::VARIANT_V0:
case xmrig::VARIANT_V1: case xmrig::VARIANT_V1:
m_variant = static_cast<xmrig::Variant>(variant); m_variant = static_cast<xmrig::Variant>(variant);
break; break;
@ -253,17 +273,20 @@ void Pool::setVariant(int variant)
} }
bool Pool::isEqual(const Pool &other) const xmrig::Variant Pool::variant() const
{ {
return (m_nicehash == other.m_nicehash switch (m_algorithm) {
&& m_keepAlive == other.m_keepAlive case xmrig::CRYPTONIGHT_HEAVY:
&& m_port == other.m_port return xmrig::VARIANT_V0;
&& m_algo == other.m_algo
&& m_host == other.m_host case xmrig::CRYPTONIGHT_IPBC:
&& m_password == other.m_password return xmrig::VARIANT_V1;
&& m_url == other.m_url
&& m_user == other.m_user default:
&& m_variant == other.m_variant); break;
}
return m_variant;
} }

View file

@ -62,22 +62,23 @@ public:
inline const char *user() const { return !m_user.isNull() ? m_user.data() : kDefaultUser; } inline const char *user() const { return !m_user.isNull() ? m_user.data() : kDefaultUser; }
inline int keepAlive() const { return m_keepAlive; } inline int keepAlive() const { return m_keepAlive; }
inline uint16_t port() const { return m_port; } 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 setKeepAlive(int keepAlive) { m_keepAlive = keepAlive >= 0 ? keepAlive : 0; }
inline void setNicehash(bool nicehash) { m_nicehash = nicehash; } inline void setNicehash(bool nicehash) { m_nicehash = nicehash; }
inline void setPassword(const char *password) { m_password = password; } inline void setPassword(const char *password) { m_password = password; }
inline void setUser(const char *user) { m_user = user; } inline void setUser(const char *user) { m_user = user; }
inline xmrig::Algo algo() const { return m_algo; } inline xmrig::Algo algorithm() const { return m_algorithm; }
inline xmrig::Variant variant() const { return m_variant; }
inline bool operator!=(const Pool &other) const { return !isEqual(other); } inline bool operator!=(const Pool &other) const { return !isEqual(other); }
inline bool operator==(const Pool &other) const { return isEqual(other); } inline bool operator==(const Pool &other) const { return isEqual(other); }
bool isEqual(const Pool &other) const;
bool parse(const char *url); bool parse(const char *url);
bool setUserpass(const char *userpass); bool setUserpass(const char *userpass);
void adjust(xmrig::Algo algo); void adjust(xmrig::Algo algorithm);
void setVariant(int variant); void setVariant(int variant);
xmrig::Variant variant() const;
bool isEqual(const Pool &other) const;
private: private:
bool parseIPv6(const char *addr); bool parseIPv6(const char *addr);
@ -85,7 +86,7 @@ private:
bool m_nicehash; bool m_nicehash;
int m_keepAlive; int m_keepAlive;
uint16_t m_port; uint16_t m_port;
xmrig::Algo m_algo; xmrig::Algo m_algorithm;
xmrig::c_str m_host; xmrig::c_str m_host;
xmrig::c_str m_password; xmrig::c_str m_password;
xmrig::c_str m_url; xmrig::c_str m_url;

View file

@ -60,7 +60,7 @@ enum AlgoVariant {
enum Variant { enum Variant {
VARIANT_AUTO = -1, // Autodetect VARIANT_AUTO = -1, // Autodetect
VARIANT_NONE = 0, // Original CryptoNight VARIANT_V0 = 0, // Original CryptoNight or CryptoNight-Heavy
VARIANT_V1 = 1 // Monero v7 PoW VARIANT_V1 = 1 // Monero v7 PoW
}; };

View file

@ -166,12 +166,9 @@ bool Network::isColors() const
void Network::setJob(Client *client, const Job &job, bool donate) void Network::setJob(Client *client, const Job &job, bool donate)
{ {
if (isColors()) { LOG_INFO(isColors() ? MAGENTA_BOLD("new job") " from " WHITE_BOLD("%s:%d") " diff " WHITE_BOLD("%d") " algo " WHITE_BOLD("%s/%d")
LOG_INFO("\x1B[01;35mnew job\x1B[0m from \x1B[01;37m%s:%d\x1B[0m diff \x1B[01;37m%d", client->host(), client->port(), job.diff()); : "new job from %s:%d diff %d algo %s/%d",
} client->host(), client->port(), job.diff(), Pool::algoName(job.algorithm(), true), static_cast<int>(job.variant()));
else {
LOG_INFO("new job from %s:%d diff %d", client->host(), client->port(), job.diff());
}
m_state.diff = job.diff(); m_state.diff = job.diff();
Workers::setJob(job, donate); Workers::setJob(job, donate);

View file

@ -26,6 +26,7 @@
#include "common/net/Client.h" #include "common/net/Client.h"
#include "common/net/Job.h" #include "common/net/Job.h"
#include "common/net/strategies/FailoverStrategy.h" #include "common/net/strategies/FailoverStrategy.h"
#include "common/net/strategies/SinglePoolStrategy.h"
#include "common/Platform.h" #include "common/Platform.h"
#include "common/xmrig.h" #include "common/xmrig.h"
#include "interfaces/IStrategyListener.h" #include "interfaces/IStrategyListener.h"
@ -41,7 +42,7 @@ static inline float randomf(float min, float max) {
} }
DonateStrategy::DonateStrategy(int level, const char *user, int algo, IStrategyListener *listener) : DonateStrategy::DonateStrategy(int level, const char *user, xmrig::Algo algo, IStrategyListener *listener) :
m_active(false), m_active(false),
m_donateTime(level * 60 * 1000), m_donateTime(level * 60 * 1000),
m_idleTime((100 - level) * 60 * 1000), m_idleTime((100 - level) * 60 * 1000),
@ -61,14 +62,24 @@ DonateStrategy::DonateStrategy(int level, const char *user, int algo, IStrategyL
} }
else if (algo == xmrig::CRYPTONIGHT_HEAVY) { else if (algo == xmrig::CRYPTONIGHT_HEAVY) {
m_pools.push_back(Pool(kDonatePool1, 8888, userId, nullptr, false, true)); m_pools.push_back(Pool(kDonatePool1, 8888, userId, nullptr, false, true));
m_pools.push_back(Pool(kDonatePool1, 8889, userId, nullptr, false, true)); }
else if (algo == xmrig::CRYPTONIGHT_IPBC) {
m_pools.push_back(Pool(kDonatePool1, 13333, userId, nullptr, false, true));
} }
else { else {
m_pools.push_back(Pool(kDonatePool1, 5555, userId, nullptr, false, true)); m_pools.push_back(Pool(kDonatePool1, 5555, userId, nullptr, false, true));
m_pools.push_back(Pool(kDonatePool1, 7777, userId, nullptr, false, true));
} }
m_strategy = new FailoverStrategy(m_pools, 1, 1, this, true); for (Pool &pool : m_pools) {
pool.setAlgo(algo);
}
if (m_pools.size() > 1) {
m_strategy = new FailoverStrategy(m_pools, 1, 2, this, true);
}
else {
m_strategy = new SinglePoolStrategy(m_pools.front(), 1, this, true);
}
m_timer.data = this; m_timer.data = this;
uv_timer_init(uv_default_loop(), &m_timer); uv_timer_init(uv_default_loop(), &m_timer);

View file

@ -43,7 +43,7 @@ class Url;
class DonateStrategy : public IStrategy, public IStrategyListener class DonateStrategy : public IStrategy, public IStrategyListener
{ {
public: public:
DonateStrategy(int level, const char *user, int algo, IStrategyListener *listener); DonateStrategy(int level, const char *user, xmrig::Algo algo, IStrategyListener *listener);
~DonateStrategy(); ~DonateStrategy();
public: public:

View file

@ -62,19 +62,19 @@ bool xmrig::CpuThread::isSoftAES(AlgoVariant av)
xmrig::CpuThread::cn_hash_fun xmrig::CpuThread::fn(Algo algorithm, AlgoVariant av, Variant variant) xmrig::CpuThread::cn_hash_fun xmrig::CpuThread::fn(Algo algorithm, AlgoVariant av, Variant variant)
{ {
assert(variant == VARIANT_NONE || variant == VARIANT_V1); assert(variant == VARIANT_V0 || variant == VARIANT_V1);
static const cn_hash_fun func_table[50] = { static const cn_hash_fun func_table[50] = {
cryptonight_single_hash<CRYPTONIGHT, false, VARIANT_NONE>, cryptonight_single_hash<CRYPTONIGHT, false, VARIANT_V0>,
cryptonight_double_hash<CRYPTONIGHT, false, VARIANT_NONE>, cryptonight_double_hash<CRYPTONIGHT, false, VARIANT_V0>,
cryptonight_single_hash<CRYPTONIGHT, true, VARIANT_NONE>, cryptonight_single_hash<CRYPTONIGHT, true, VARIANT_V0>,
cryptonight_double_hash<CRYPTONIGHT, true, VARIANT_NONE>, cryptonight_double_hash<CRYPTONIGHT, true, VARIANT_V0>,
cryptonight_triple_hash<CRYPTONIGHT, false, VARIANT_NONE>, cryptonight_triple_hash<CRYPTONIGHT, false, VARIANT_V0>,
cryptonight_quad_hash<CRYPTONIGHT, false, VARIANT_NONE>, cryptonight_quad_hash<CRYPTONIGHT, false, VARIANT_V0>,
cryptonight_penta_hash<CRYPTONIGHT, false, VARIANT_NONE>, cryptonight_penta_hash<CRYPTONIGHT, false, VARIANT_V0>,
cryptonight_triple_hash<CRYPTONIGHT, true, VARIANT_NONE>, cryptonight_triple_hash<CRYPTONIGHT, true, VARIANT_V0>,
cryptonight_quad_hash<CRYPTONIGHT, true, VARIANT_NONE>, cryptonight_quad_hash<CRYPTONIGHT, true, VARIANT_V0>,
cryptonight_penta_hash<CRYPTONIGHT, true, VARIANT_NONE>, cryptonight_penta_hash<CRYPTONIGHT, true, VARIANT_V0>,
cryptonight_single_hash<CRYPTONIGHT, false, VARIANT_V1>, cryptonight_single_hash<CRYPTONIGHT, false, VARIANT_V1>,
cryptonight_double_hash<CRYPTONIGHT, false, VARIANT_V1>, cryptonight_double_hash<CRYPTONIGHT, false, VARIANT_V1>,
@ -88,16 +88,16 @@ xmrig::CpuThread::cn_hash_fun xmrig::CpuThread::fn(Algo algorithm, AlgoVariant a
cryptonight_penta_hash<CRYPTONIGHT, true, VARIANT_V1>, cryptonight_penta_hash<CRYPTONIGHT, true, VARIANT_V1>,
# ifndef XMRIG_NO_AEON # ifndef XMRIG_NO_AEON
cryptonight_single_hash<CRYPTONIGHT_LITE, false, VARIANT_NONE>, cryptonight_single_hash<CRYPTONIGHT_LITE, false, VARIANT_V0>,
cryptonight_double_hash<CRYPTONIGHT_LITE, false, VARIANT_NONE>, cryptonight_double_hash<CRYPTONIGHT_LITE, false, VARIANT_V0>,
cryptonight_single_hash<CRYPTONIGHT_LITE, true, VARIANT_NONE>, cryptonight_single_hash<CRYPTONIGHT_LITE, true, VARIANT_V0>,
cryptonight_double_hash<CRYPTONIGHT_LITE, true, VARIANT_NONE>, cryptonight_double_hash<CRYPTONIGHT_LITE, true, VARIANT_V0>,
cryptonight_triple_hash<CRYPTONIGHT_LITE, false, VARIANT_NONE>, cryptonight_triple_hash<CRYPTONIGHT_LITE, false, VARIANT_V0>,
cryptonight_quad_hash<CRYPTONIGHT_LITE, false, VARIANT_NONE>, cryptonight_quad_hash<CRYPTONIGHT_LITE, false, VARIANT_V0>,
cryptonight_penta_hash<CRYPTONIGHT_LITE, false, VARIANT_NONE>, cryptonight_penta_hash<CRYPTONIGHT_LITE, false, VARIANT_V0>,
cryptonight_triple_hash<CRYPTONIGHT_LITE, true, VARIANT_NONE>, cryptonight_triple_hash<CRYPTONIGHT_LITE, true, VARIANT_V0>,
cryptonight_quad_hash<CRYPTONIGHT_LITE, true, VARIANT_NONE>, cryptonight_quad_hash<CRYPTONIGHT_LITE, true, VARIANT_V0>,
cryptonight_penta_hash<CRYPTONIGHT_LITE, true, VARIANT_NONE>, cryptonight_penta_hash<CRYPTONIGHT_LITE, true, VARIANT_V0>,
cryptonight_single_hash<CRYPTONIGHT_LITE, false, VARIANT_V1>, cryptonight_single_hash<CRYPTONIGHT_LITE, false, VARIANT_V1>,
cryptonight_double_hash<CRYPTONIGHT_LITE, false, VARIANT_V1>, cryptonight_double_hash<CRYPTONIGHT_LITE, false, VARIANT_V1>,
@ -115,16 +115,16 @@ xmrig::CpuThread::cn_hash_fun xmrig::CpuThread::fn(Algo algorithm, AlgoVariant a
# endif # endif
# ifndef XMRIG_NO_SUMO # ifndef XMRIG_NO_SUMO
cryptonight_single_hash<CRYPTONIGHT_HEAVY, false, VARIANT_NONE>, cryptonight_single_hash<CRYPTONIGHT_HEAVY, false, VARIANT_V0>,
cryptonight_double_hash<CRYPTONIGHT_HEAVY, false, VARIANT_NONE>, cryptonight_double_hash<CRYPTONIGHT_HEAVY, false, VARIANT_V0>,
cryptonight_single_hash<CRYPTONIGHT_HEAVY, true, VARIANT_NONE>, cryptonight_single_hash<CRYPTONIGHT_HEAVY, true, VARIANT_V0>,
cryptonight_double_hash<CRYPTONIGHT_HEAVY, true, VARIANT_NONE>, cryptonight_double_hash<CRYPTONIGHT_HEAVY, true, VARIANT_V0>,
cryptonight_triple_hash<CRYPTONIGHT_HEAVY, false, VARIANT_NONE>, cryptonight_triple_hash<CRYPTONIGHT_HEAVY, false, VARIANT_V0>,
cryptonight_quad_hash<CRYPTONIGHT_HEAVY, false, VARIANT_NONE>, cryptonight_quad_hash<CRYPTONIGHT_HEAVY, false, VARIANT_V0>,
cryptonight_penta_hash<CRYPTONIGHT_HEAVY, false, VARIANT_NONE>, cryptonight_penta_hash<CRYPTONIGHT_HEAVY, false, VARIANT_V0>,
cryptonight_triple_hash<CRYPTONIGHT_HEAVY, true, VARIANT_NONE>, cryptonight_triple_hash<CRYPTONIGHT_HEAVY, true, VARIANT_V0>,
cryptonight_quad_hash<CRYPTONIGHT_HEAVY, true, VARIANT_NONE>, cryptonight_quad_hash<CRYPTONIGHT_HEAVY, true, VARIANT_V0>,
cryptonight_penta_hash<CRYPTONIGHT_HEAVY, true, VARIANT_NONE>, cryptonight_penta_hash<CRYPTONIGHT_HEAVY, true, VARIANT_V0>,
# else # else
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
# endif # endif
@ -132,7 +132,7 @@ xmrig::CpuThread::cn_hash_fun xmrig::CpuThread::fn(Algo algorithm, AlgoVariant a
# ifndef XMRIG_NO_SUMO # ifndef XMRIG_NO_SUMO
if (algorithm == CRYPTONIGHT_HEAVY) { if (algorithm == CRYPTONIGHT_HEAVY) {
variant = VARIANT_NONE; variant = VARIANT_V0;
} }
# endif # endif

View file

@ -50,11 +50,11 @@ MultiWorker<N>::~MultiWorker()
template<size_t N> template<size_t N>
bool MultiWorker<N>::selfTest() bool MultiWorker<N>::selfTest()
{ {
if (m_thread->fn(xmrig::VARIANT_NONE) == nullptr) { if (m_thread->fn(xmrig::VARIANT_V0) == nullptr) {
return false; return false;
} }
m_thread->fn(xmrig::VARIANT_NONE)(test_input, 76, m_hash, m_ctx); m_thread->fn(xmrig::VARIANT_V0)(test_input, 76, m_hash, m_ctx);
if (m_thread->algorithm() == xmrig::CRYPTONIGHT && memcmp(m_hash, test_output_v0, sizeof m_hash) == 0) { 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_V1)(test_input, 76, m_hash, m_ctx);