1
0
mirror of https://github.com/xmrig/xmrig.git synced 2025-12-31 07:32:42 -05:00

Merge branch 'master' into self-select-parse-fix

This commit is contained in:
Stan Bondi
2021-11-01 18:16:55 +04:00
committed by GitHub
401 changed files with 44736 additions and 13908 deletions

View File

@@ -20,7 +20,6 @@
#include "base/net/stratum/SelfSelectClient.h"
#include "3rdparty/http-parser/http_parser.h"
#include "3rdparty/rapidjson/document.h"
#include "3rdparty/rapidjson/error/en.h"
#include "base/io/json/Json.h"
@@ -76,7 +75,14 @@ int64_t xmrig::SelfSelectClient::submit(const JobResult &result)
submitOriginDaemon(result);
}
return m_client->submit(result);
uint64_t submit_result = m_client->submit(result);
if (m_submitToOrigin) {
// Ensure that the latest block template is available after block submission
getBlockTemplate();
}
return submit_result;
}
@@ -148,12 +154,17 @@ bool xmrig::SelfSelectClient::parseResponse(int64_t id, rapidjson::Value &result
}
}
if (!m_job.setBlob(result[kBlockhashingBlob].GetString())) {
return false;
const char *blobData = Json::getString(result, kBlockhashingBlob);
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()) {
m_job.setAlgorithm(pool().coin().algorithm(m_job.blob()[0]));
if (!m_job.setBlob(blobData)) {
return false;
}
m_job.setHeight(Json::getUint64(result, kHeight));
@@ -302,12 +313,11 @@ void xmrig::SelfSelectClient::submitOriginDaemon(const JobResult& result)
LOG_INFO("%s " GREEN_BOLD("submitted to origin daemon") " (%" PRId64 "/%" PRId64 ") "
" diff " WHITE("%" PRIu64) " vs. " WHITE("%" PRIu64),
Tags::origin(), m_originSubmitted, m_originNotSubmitted, m_blockDiff, result.actualDiff(), result.diff);
}
void xmrig::SelfSelectClient::onHttpData(const HttpData &data)
{
if (data.status != HTTP_STATUS_OK) {
if (data.status != 200) {
return retry();
}