Browse Source

Merge branch 'master' of https://github.com/esrrhs/xmrig into pr2217

pull/2225/head
XMRig 3 years ago
parent
commit
b72e21fc3c
No known key found for this signature in database GPG Key ID: 446A53638BE94409
  1. 16
      src/base/net/stratum/Client.cpp
  2. 8
      src/base/net/stratum/DaemonClient.cpp
  3. 2
      src/base/net/stratum/benchmark/BenchClient.cpp

16
src/base/net/stratum/Client.cpp

@ -378,6 +378,14 @@ bool xmrig::Client::parseJob(const rapidjson::Value &params, 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 &params, 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)) {

8
src/base/net/stratum/DaemonClient.cpp

@ -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);
}
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 &params, 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");

2
src/base/net/stratum/benchmark/BenchClient.cpp

@ -48,8 +48,8 @@ xmrig::BenchClient::BenchClient(const std::shared_ptr<BenchConfig> &benchmark, I
std::vector<char> 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<uint64_t>::max());
m_job.setHeight(1);
m_job.setId("00000000");

Loading…
Cancel
Save