#692 Add support for global algorithm variant.

This commit is contained in:
XMRig 2018-06-14 23:49:30 +07:00
parent 33d9094cdc
commit de6ee749fe
4 changed files with 16 additions and 11 deletions

View file

@ -123,7 +123,7 @@ bool xmrig::CommonConfig::finalize()
} }
for (Pool &pool : m_pools) { for (Pool &pool : m_pools) {
pool.adjust(m_algorithm.algo()); pool.adjust(m_algorithm);
if (pool.isValid() && pool.algorithm().isValid()) { if (pool.isValid() && pool.algorithm().isValid()) {
m_activePools.push_back(std::move(pool)); m_activePools.push_back(std::move(pool));

View file

@ -223,22 +223,27 @@ rapidjson::Value Pool::toJSON(rapidjson::Document &doc) const
} }
void Pool::adjust(xmrig::Algo algorithm) void Pool::adjust(const xmrig::Algorithm &algorithm)
{ {
using namespace xmrig;
if (!isValid()) { if (!isValid()) {
return; return;
} }
if (!m_algorithm.isValid()) { if (!m_algorithm.isValid()) {
m_algorithm.setAlgo(algorithm); m_algorithm.setAlgo(algorithm.algo());
# ifndef XMRIG_PROXY_PROJECT # ifndef XMRIG_PROXY_PROJECT
if (m_algorithm.variant() == xmrig::VARIANT_AUTO) { if (m_algorithm.variant() == VARIANT_AUTO) {
if (algorithm == xmrig::CRYPTONIGHT_HEAVY) { if (algorithm.variant() != VARIANT_AUTO) {
m_algorithm.setVariant(xmrig::VARIANT_0); m_algorithm.setVariant(algorithm.variant());
}
else if (algorithm.algo() == CRYPTONIGHT_HEAVY) {
m_algorithm.setVariant(VARIANT_0);
} }
else { else {
m_algorithm.setVariant(xmrig::VARIANT_1); m_algorithm.setVariant(VARIANT_1);
} }
} }
# endif # endif
@ -249,13 +254,13 @@ void Pool::adjust(xmrig::Algo algorithm)
m_nicehash = true; m_nicehash = true;
if (strstr(m_host.data(), "cryptonightv7.")) { if (strstr(m_host.data(), "cryptonightv7.")) {
m_algorithm.setVariant(xmrig::VARIANT_1); m_algorithm.setVariant(VARIANT_1);
} }
} }
if (strstr(m_host.data(), ".minergate.com")) { if (strstr(m_host.data(), ".minergate.com")) {
m_keepAlive = false; m_keepAlive = false;
m_algorithm.setVariant(xmrig::VARIANT_1); m_algorithm.setVariant(VARIANT_1);
} }
rebuild(); rebuild();

View file

@ -77,7 +77,7 @@ public:
bool parse(const char *url); bool parse(const char *url);
bool setUserpass(const char *userpass); bool setUserpass(const char *userpass);
rapidjson::Value toJSON(rapidjson::Document &doc) const; rapidjson::Value toJSON(rapidjson::Document &doc) const;
void adjust(xmrig::Algo algorithm); void adjust(const xmrig::Algorithm &algorithm);
void setAlgo(const xmrig::Algorithm &algorithm); void setAlgo(const xmrig::Algorithm &algorithm);
# ifdef APP_DEBUG # ifdef APP_DEBUG

View file

@ -68,7 +68,7 @@ DonateStrategy::DonateStrategy(int level, const char *user, xmrig::Algo algo, IS
} }
for (Pool &pool : m_pools) { for (Pool &pool : m_pools) {
pool.adjust(algo); pool.adjust(xmrig::Algorithm(algo, xmrig::VARIANT_AUTO));
} }
if (m_pools.size() > 1) { if (m_pools.size() > 1) {