Merge branch 'pr2217' into dev

This commit is contained in:
XMRig 2021-03-29 18:17:33 +07:00
commit bad5458d40
No known key found for this signature in database
GPG key ID: 446A53638BE94409
3 changed files with 13 additions and 13 deletions

View file

@ -378,6 +378,14 @@ bool xmrig::Client::parseJob(const rapidjson::Value &params, int *code)
return false; return false;
} }
const char *algo = Json::getString(params, "algo");
if (algo) {
job.setAlgorithm(algo);
}
else if (m_pool.coin().isValid()) {
job.setAlgorithm(m_pool.coin().algorithm(job.blob()[0]));
}
# ifdef XMRIG_FEATURE_HTTP # ifdef XMRIG_FEATURE_HTTP
if (m_pool.mode() == Pool::MODE_SELF_SELECT) { if (m_pool.mode() == Pool::MODE_SELF_SELECT) {
job.setExtraNonce(Json::getString(params, "extra_nonce")); job.setExtraNonce(Json::getString(params, "extra_nonce"));
@ -402,14 +410,6 @@ bool xmrig::Client::parseJob(const rapidjson::Value &params, int *code)
return false; return false;
} }
const char *algo = Json::getString(params, "algo");
if (algo) {
job.setAlgorithm(algo);
}
else if (m_pool.coin().isValid()) {
job.setAlgorithm(m_pool.coin().algorithm(job.blob()[0]));
}
job.setHeight(Json::getUint64(params, "height")); job.setHeight(Json::getUint64(params, "height"));
if (!verifyAlgorithm(job.algorithm(), algo)) { if (!verifyAlgorithm(job.algorithm(), algo)) {

View file

@ -247,6 +247,10 @@ bool xmrig::DaemonClient::parseJob(const rapidjson::Value &params, int *code)
Cvt::toHex(m_blockhashingblob.data() + offset * 2, kBlobReserveSize * 2, Cvt::randomBytes(kBlobReserveSize).data(), kBlobReserveSize); Cvt::toHex(m_blockhashingblob.data() + offset * 2, kBlobReserveSize * 2, Cvt::randomBytes(kBlobReserveSize).data(), kBlobReserveSize);
} }
if (m_pool.coin().isValid()) {
job.setAlgorithm(m_pool.coin().algorithm(job.blob()[0]));
}
if (blocktemplate.isNull() || !job.setBlob(m_blockhashingblob)) { if (blocktemplate.isNull() || !job.setBlob(m_blockhashingblob)) {
*code = 4; *code = 4;
return false; return false;
@ -257,10 +261,6 @@ bool xmrig::DaemonClient::parseJob(const rapidjson::Value &params, int *code)
job.setDiff(Json::getUint64(params, "difficulty")); job.setDiff(Json::getUint64(params, "difficulty"));
job.setId(blocktemplate.data() + blocktemplate.size() - 32); job.setId(blocktemplate.data() + blocktemplate.size() - 32);
if (m_pool.coin().isValid()) {
job.setAlgorithm(m_pool.coin().algorithm(job.blob()[0]));
}
m_job = std::move(job); m_job = std::move(job);
m_blocktemplate = std::move(blocktemplate); m_blocktemplate = std::move(blocktemplate);
m_prevHash = Json::getString(params, "prev_hash"); m_prevHash = Json::getString(params, "prev_hash");

View file

@ -48,8 +48,8 @@ xmrig::BenchClient::BenchClient(const std::shared_ptr<BenchConfig> &benchmark, I
std::vector<char> blob(112 * 2 + 1, '0'); std::vector<char> blob(112 * 2 + 1, '0');
blob.back() = '\0'; blob.back() = '\0';
m_job.setBlob(blob.data());
m_job.setAlgorithm(m_benchmark->algorithm()); m_job.setAlgorithm(m_benchmark->algorithm());
m_job.setBlob(blob.data());
m_job.setDiff(std::numeric_limits<uint64_t>::max()); m_job.setDiff(std::numeric_limits<uint64_t>::max());
m_job.setHeight(1); m_job.setHeight(1);
m_job.setId("00000000"); m_job.setId("00000000");