From a3873930a083ac80d28d879124a4f250005841b5 Mon Sep 17 00:00:00 2001 From: XMRig Date: Sat, 1 Sep 2018 00:31:31 +0300 Subject: [PATCH] Fixed automatic variant. --- src/common/net/Job.cpp | 14 ++------------ src/common/net/Job.h | 7 ++++--- src/common/net/Pool.cpp | 3 ++- src/common/net/Pool.h | 7 ++++--- src/net/Network.cpp | 5 ++++- src/workers/MultiWorker.cpp | 1 + src/workers/MultiWorker.h | 7 ++++--- 7 files changed, 21 insertions(+), 23 deletions(-) diff --git a/src/common/net/Job.cpp b/src/common/net/Job.cpp index e9f81e02..3d2d88ad 100644 --- a/src/common/net/Job.cpp +++ b/src/common/net/Job.cpp @@ -6,6 +6,7 @@ * Copyright 2016 Jay D Dee * Copyright 2017-2018 XMR-Stak , * Copyright 2018 Lee Clagett + * Copyright 2018 SChernykh * Copyright 2016-2018 XMRig , * * This program is free software: you can redistribute it and/or modify @@ -165,24 +166,13 @@ bool Job::setTarget(const char *target) xmrig::Variant Job::variant() const { - if (m_algorithm.variant() == xmrig::VARIANT_XTL && m_blob[0] < 4) { - return xmrig::VARIANT_1; - } - - if (m_algorithm.variant() == xmrig::VARIANT_MSR && m_blob[0] < 7) { - return xmrig::VARIANT_1; - } - - if (m_algorithm.variant() == xmrig::VARIANT_XHV && m_blob[0] < 3) { - return xmrig::VARIANT_0; - } - if (m_algorithm.variant() == xmrig::VARIANT_AUTO) { if (m_algorithm.algo() == xmrig::CRYPTONIGHT_HEAVY) { return xmrig::VARIANT_0; } else if (m_algorithm.algo() == xmrig::CRYPTONIGHT_LITE) { return xmrig::VARIANT_1; } + return (m_blob[0] >= 8) ? xmrig::VARIANT_2 : xmrig::VARIANT_1; } diff --git a/src/common/net/Job.h b/src/common/net/Job.h index 049eb7d4..7ea539a2 100644 --- a/src/common/net/Job.h +++ b/src/common/net/Job.h @@ -6,6 +6,7 @@ * Copyright 2016 Jay D Dee * Copyright 2017-2018 XMR-Stak , * Copyright 2018 Lee Clagett + * Copyright 2018 SChernykh * Copyright 2016-2018 XMRig , * * This program is free software: you can redistribute it and/or modify @@ -22,8 +23,8 @@ * along with this program. If not, see . */ -#ifndef __JOB_H__ -#define __JOB_H__ +#ifndef XMRIG_JOB_H +#define XMRIG_JOB_H #include @@ -100,4 +101,4 @@ private: # endif }; -#endif /* __JOB_H__ */ +#endif /* XMRIG_JOB_H */ diff --git a/src/common/net/Pool.cpp b/src/common/net/Pool.cpp index 357cb330..49f4e54c 100644 --- a/src/common/net/Pool.cpp +++ b/src/common/net/Pool.cpp @@ -5,6 +5,7 @@ * Copyright 2014-2016 Wolf9466 * Copyright 2016 Jay D Dee * Copyright 2017-2018 XMR-Stak , + * Copyright 2018 SChernykh * Copyright 2016-2018 XMRig , * * This program is free software: you can redistribute it and/or modify @@ -360,7 +361,7 @@ void Pool::adjustVariant(const xmrig::Variant variantHint) if (m_algorithm.algo() == CRYPTONIGHT_HEAVY) { m_algorithm.setVariant(VARIANT_0); } - else { + else if (m_algorithm.algo() == CRYPTONIGHT_LITE) { m_algorithm.setVariant(VARIANT_1); } # endif diff --git a/src/common/net/Pool.h b/src/common/net/Pool.h index 57a30d1e..0641b851 100644 --- a/src/common/net/Pool.h +++ b/src/common/net/Pool.h @@ -5,6 +5,7 @@ * Copyright 2014-2016 Wolf9466 * Copyright 2016 Jay D Dee * Copyright 2017-2018 XMR-Stak , + * Copyright 2018 SChernykh * Copyright 2016-2018 XMRig , * * This program is free software: you can redistribute it and/or modify @@ -21,8 +22,8 @@ * along with this program. If not, see . */ -#ifndef __POOL_H__ -#define __POOL_H__ +#ifndef XMRIG_POOL_H +#define XMRIG_POOL_H #include @@ -105,4 +106,4 @@ private: typedef std::vector Pools; -#endif /* __POOL_H__ */ +#endif /* XMRIG_POOL_H */ diff --git a/src/net/Network.cpp b/src/net/Network.cpp index 7293a0ac..cc979635 100644 --- a/src/net/Network.cpp +++ b/src/net/Network.cpp @@ -166,9 +166,12 @@ bool Network::isColors() const void Network::setJob(Client *client, const Job &job, bool donate) { + xmrig::Algorithm algorithm = job.algorithm(); + algorithm.setVariant(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()); + client->host(), client->port(), job.diff(), algorithm.shortName()); m_state.diff = job.diff(); Workers::setJob(job, donate); diff --git a/src/workers/MultiWorker.cpp b/src/workers/MultiWorker.cpp index 475f99be..1916b205 100644 --- a/src/workers/MultiWorker.cpp +++ b/src/workers/MultiWorker.cpp @@ -6,6 +6,7 @@ * Copyright 2016 Jay D Dee * Copyright 2017-2018 XMR-Stak , * Copyright 2018 Lee Clagett + * Copyright 2018 SChernykh * Copyright 2016-2018 XMRig , * * This program is free software: you can redistribute it and/or modify diff --git a/src/workers/MultiWorker.h b/src/workers/MultiWorker.h index d4a6910e..c08e4fbe 100644 --- a/src/workers/MultiWorker.h +++ b/src/workers/MultiWorker.h @@ -6,6 +6,7 @@ * Copyright 2016 Jay D Dee * Copyright 2017-2018 XMR-Stak , * Copyright 2018 Lee Clagett + * Copyright 2018 SChernykh * Copyright 2016-2018 XMRig , * * This program is free software: you can redistribute it and/or modify @@ -22,8 +23,8 @@ * along with this program. If not, see . */ -#ifndef __MULTIWORKER_H__ -#define __MULTIWORKER_H__ +#ifndef XMRIG_MULTIWORKER_H +#define XMRIG_MULTIWORKER_H #include "common/net/Job.h" @@ -71,4 +72,4 @@ private: }; -#endif /* __MULTIWORKER_H__ */ +#endif /* XMRIG_MULTIWORKER_H */