Merge pull request #2239 from SChernykh/dev

Fixed broken "coin" setting functionality
This commit is contained in:
xmrig 2021-04-07 10:30:28 +07:00 committed by GitHub
commit 2a66a0fa2f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 7 deletions

View file

@ -379,11 +379,16 @@ bool xmrig::Client::parseJob(const rapidjson::Value &params, int *code)
} }
const char *algo = Json::getString(params, "algo"); const char *algo = Json::getString(params, "algo");
const char *blobData = Json::getString(params, "blob");
if (algo) { if (algo) {
job.setAlgorithm(algo); job.setAlgorithm(algo);
} }
else if (m_pool.coin().isValid()) { else if (m_pool.coin().isValid()) {
job.setAlgorithm(m_pool.coin().algorithm(job.blob()[0])); uint8_t blobVersion = 0;
if (blobData) {
Cvt::fromHex(&blobVersion, 1, blobData, 2);
}
job.setAlgorithm(m_pool.coin().algorithm(blobVersion));
} }
# ifdef XMRIG_FEATURE_HTTP # ifdef XMRIG_FEATURE_HTTP
@ -399,7 +404,7 @@ bool xmrig::Client::parseJob(const rapidjson::Value &params, int *code)
else else
# endif # endif
{ {
if (!job.setBlob(params["blob"].GetString())) { if (!job.setBlob(blobData)) {
*code = 4; *code = 4;
return false; return false;
} }

View file

@ -248,7 +248,9 @@ bool xmrig::DaemonClient::parseJob(const rapidjson::Value &params, int *code)
} }
if (m_pool.coin().isValid()) { if (m_pool.coin().isValid()) {
job.setAlgorithm(m_pool.coin().algorithm(job.blob()[0])); uint8_t blobVersion = 0;
Cvt::fromHex(&blobVersion, 1, m_blockhashingblob.data(), 2);
job.setAlgorithm(m_pool.coin().algorithm(blobVersion));
} }
if (blocktemplate.isNull() || !job.setBlob(m_blockhashingblob)) { if (blocktemplate.isNull() || !job.setBlob(m_blockhashingblob)) {

View file

@ -130,12 +130,17 @@ bool xmrig::SelfSelectClient::parseResponse(int64_t id, rapidjson::Value &result
} }
} }
if (!m_job.setBlob(result[kBlockhashingBlob].GetString())) { const char *blobData = Json::getString(result, kBlockhashingBlob);
return false; if (pool().coin().isValid()) {
uint8_t blobVersion = 0;
if (blobData) {
Cvt::fromHex(&blobVersion, 1, blobData, 2);
}
m_job.setAlgorithm(pool().coin().algorithm(blobVersion));
} }
if (pool().coin().isValid()) { if (!m_job.setBlob(blobData)) {
m_job.setAlgorithm(pool().coin().algorithm(m_job.blob()[0])); return false;
} }
m_job.setHeight(Json::getUint64(result, kHeight)); m_job.setHeight(Json::getUint64(result, kHeight));