mirror of
https://github.com/xmrig/xmrig.git
synced 2026-01-19 13:33:00 -05:00
Merge xmrig v6.10.0 into master
This commit is contained in:
@@ -25,7 +25,6 @@
|
||||
|
||||
|
||||
#include "base/net/stratum/DaemonClient.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"
|
||||
@@ -151,7 +150,7 @@ void xmrig::DaemonClient::connect(const Pool &pool)
|
||||
|
||||
void xmrig::DaemonClient::onHttpData(const HttpData &data)
|
||||
{
|
||||
if (data.status != HTTP_STATUS_OK) {
|
||||
if (data.status != 200) {
|
||||
return retry();
|
||||
}
|
||||
|
||||
@@ -179,12 +178,30 @@ void xmrig::DaemonClient::onHttpData(const HttpData &data)
|
||||
return send(kGetInfo);
|
||||
}
|
||||
|
||||
if (isOutdated(Json::getUint64(doc, kHeight), Json::getString(doc, kHash))) {
|
||||
getBlockTemplate();
|
||||
const uint64_t height = Json::getUint64(doc, kHeight);
|
||||
const String hash = Json::getString(doc, kHash);
|
||||
|
||||
if (isOutdated(height, hash)) {
|
||||
// Multiple /getheight responses can come at once resulting in multiple getBlockTemplate() calls
|
||||
if ((height != m_blocktemplateRequestHeight) || (hash != m_blocktemplateRequestHash)) {
|
||||
m_blocktemplateRequestHeight = height;
|
||||
m_blocktemplateRequestHash = hash;
|
||||
getBlockTemplate();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (data.url == kGetInfo && isOutdated(Json::getUint64(doc, kHeight), Json::getString(doc, "top_block_hash"))) {
|
||||
getBlockTemplate();
|
||||
else if (data.url == kGetInfo) {
|
||||
const uint64_t height = Json::getUint64(doc, kHeight);
|
||||
const String hash = Json::getString(doc, "top_block_hash");
|
||||
|
||||
if (isOutdated(height, hash)) {
|
||||
// Multiple /getinfo responses can come at once resulting in multiple getBlockTemplate() calls
|
||||
if ((height != m_blocktemplateRequestHeight) || (hash != m_blocktemplateRequestHash)) {
|
||||
m_blocktemplateRequestHeight = height;
|
||||
m_blocktemplateRequestHash = hash;
|
||||
getBlockTemplate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
@@ -89,6 +89,8 @@ private:
|
||||
String m_tlsFingerprint;
|
||||
String m_tlsVersion;
|
||||
Timer *m_timer;
|
||||
uint64_t m_blocktemplateRequestHeight = 0;
|
||||
String m_blocktemplateRequestHash;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -119,8 +119,10 @@ bool xmrig::Job::setTarget(const char *target)
|
||||
}
|
||||
|
||||
# ifdef XMRIG_PROXY_PROJECT
|
||||
assert(sizeof(m_rawTarget) > (size * 2));
|
||||
|
||||
memset(m_rawTarget, 0, sizeof(m_rawTarget));
|
||||
memcpy(m_rawTarget, target, len);
|
||||
memcpy(m_rawTarget, target, std::min(size * 2, sizeof(m_rawTarget)));
|
||||
# endif
|
||||
|
||||
m_diff = toDiff(m_target);
|
||||
@@ -134,8 +136,7 @@ void xmrig::Job::setDiff(uint64_t diff)
|
||||
m_target = toDiff(diff);
|
||||
|
||||
# ifdef XMRIG_PROXY_PROJECT
|
||||
Buffer::toHex(reinterpret_cast<uint8_t *>(&m_target), 8, m_rawTarget);
|
||||
m_rawTarget[16] = '\0';
|
||||
Cvt::toHex(m_rawTarget, sizeof(m_rawTarget), reinterpret_cast<uint8_t *>(&m_target), sizeof(m_target));
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
@@ -206,7 +206,7 @@ void xmrig::NetworkState::printConnection() const
|
||||
void xmrig::NetworkState::printResults() const
|
||||
{
|
||||
if (!m_hashes) {
|
||||
LOG_NOTICE(YELLOW_BOLD_S "no any results yet");
|
||||
LOG_NOTICE(YELLOW_BOLD_S "no results yet");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
@@ -288,7 +287,7 @@ void xmrig::SelfSelectClient::submitOriginDaemon(const JobResult& result)
|
||||
|
||||
void xmrig::SelfSelectClient::onHttpData(const HttpData &data)
|
||||
{
|
||||
if (data.status != HTTP_STATUS_OK) {
|
||||
if (data.status != 200) {
|
||||
return retry();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user