From be232fa1f26b0e73f92146668c42bd3fae8e0172 Mon Sep 17 00:00:00 2001 From: XMRig Date: Fri, 27 Apr 2018 00:40:22 +0700 Subject: [PATCH] Also support variant received as string. --- src/common/crypto/Algorithm.cpp | 1 + src/common/net/Client.cpp | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/common/crypto/Algorithm.cpp b/src/common/crypto/Algorithm.cpp index 3123c361e..168468f48 100644 --- a/src/common/crypto/Algorithm.cpp +++ b/src/common/crypto/Algorithm.cpp @@ -127,6 +127,7 @@ void xmrig::Algorithm::parseAlgorithm(const char *algo) void xmrig::Algorithm::parseVariant(const char *variant) { if (m_algo == CRYPTONIGHT_HEAVY) { + m_variant = VARIANT_0; return; } diff --git a/src/common/net/Client.cpp b/src/common/net/Client.cpp index c53397a34..921fa618b 100644 --- a/src/common/net/Client.cpp +++ b/src/common/net/Client.cpp @@ -274,7 +274,14 @@ bool Client::parseJob(const rapidjson::Value ¶ms, int *code) } if (params.HasMember("variant")) { - job.algorithm().parseVariant(params["variant"].GetInt()); + const rapidjson::Value &variant = params["variant"]; + + if (variant.IsInt()) { + job.algorithm().parseVariant(variant.GetInt()); + } + else if (variant.IsString()){ + job.algorithm().parseVariant(variant.GetString()); + } } if (!verifyAlgorithm(job.algorithm())) {