diff --git a/src/base/net/stratum/Client.cpp b/src/base/net/stratum/Client.cpp index fd4d13a7..78c0976f 100644 --- a/src/base/net/stratum/Client.cpp +++ b/src/base/net/stratum/Client.cpp @@ -378,6 +378,14 @@ bool xmrig::Client::parseJob(const rapidjson::Value ¶ms, int *code) 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 if (m_pool.mode() == Pool::MODE_SELF_SELECT) { job.setExtraNonce(Json::getString(params, "extra_nonce")); @@ -402,14 +410,6 @@ bool xmrig::Client::parseJob(const rapidjson::Value ¶ms, int *code) 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")); if (!verifyAlgorithm(job.algorithm(), algo)) { diff --git a/src/base/net/stratum/DaemonClient.cpp b/src/base/net/stratum/DaemonClient.cpp index 087fd0f7..c429039d 100644 --- a/src/base/net/stratum/DaemonClient.cpp +++ b/src/base/net/stratum/DaemonClient.cpp @@ -247,6 +247,10 @@ bool xmrig::DaemonClient::parseJob(const rapidjson::Value ¶ms, int *code) 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)) { *code = 4; return false; @@ -257,10 +261,6 @@ bool xmrig::DaemonClient::parseJob(const rapidjson::Value ¶ms, int *code) job.setDiff(Json::getUint64(params, "difficulty")); 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_blocktemplate = std::move(blocktemplate); m_prevHash = Json::getString(params, "prev_hash"); diff --git a/src/base/net/stratum/benchmark/BenchClient.cpp b/src/base/net/stratum/benchmark/BenchClient.cpp index 11b0d2ba..39b50e86 100644 --- a/src/base/net/stratum/benchmark/BenchClient.cpp +++ b/src/base/net/stratum/benchmark/BenchClient.cpp @@ -48,8 +48,8 @@ xmrig::BenchClient::BenchClient(const std::shared_ptr &benchmark, I std::vector blob(112 * 2 + 1, '0'); blob.back() = '\0'; - m_job.setBlob(blob.data()); m_job.setAlgorithm(m_benchmark->algorithm()); + m_job.setBlob(blob.data()); m_job.setDiff(std::numeric_limits::max()); m_job.setHeight(1); m_job.setId("00000000");