Also support variant received as string.

This commit is contained in:
XMRig 2018-04-27 00:40:22 +07:00
parent 3df99fbced
commit be232fa1f2
2 changed files with 9 additions and 1 deletions

View file

@ -127,6 +127,7 @@ void xmrig::Algorithm::parseAlgorithm(const char *algo)
void xmrig::Algorithm::parseVariant(const char *variant) void xmrig::Algorithm::parseVariant(const char *variant)
{ {
if (m_algo == CRYPTONIGHT_HEAVY) { if (m_algo == CRYPTONIGHT_HEAVY) {
m_variant = VARIANT_0;
return; return;
} }

View file

@ -274,7 +274,14 @@ bool Client::parseJob(const rapidjson::Value &params, int *code)
} }
if (params.HasMember("variant")) { 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())) { if (!verifyAlgorithm(job.algorithm())) {