mirror of
https://github.com/xmrig/xmrig.git
synced 2024-11-17 08:17:40 +00:00
Fixed NiceHash disconnects for KawPow
This commit is contained in:
parent
945d1db05c
commit
28c81f2c53
3 changed files with 30 additions and 2 deletions
|
@ -145,6 +145,22 @@ void xmrig::EthStratumClient::parseNotification(const char *method, const rapidj
|
|||
return;
|
||||
}
|
||||
|
||||
if (strcmp(method, "mining.set_extranonce") == 0) {
|
||||
if (!params.IsArray()) {
|
||||
LOG_ERR("%s " RED("invalid mining.set_extranonce notification: params is not an array"), tag());
|
||||
return;
|
||||
}
|
||||
|
||||
auto arr = params.GetArray();
|
||||
|
||||
if (arr.Empty()) {
|
||||
LOG_ERR("%s " RED("invalid mining.set_extranonce notification: params array is empty"), tag());
|
||||
return;
|
||||
}
|
||||
|
||||
setExtraNonce(arr[0]);
|
||||
}
|
||||
|
||||
if (strcmp(method, "mining.notify") == 0) {
|
||||
if (!params.IsArray()) {
|
||||
LOG_ERR("%s " RED("invalid mining.notify notification: params is not an array"), tag());
|
||||
|
@ -345,6 +361,14 @@ void xmrig::EthStratumClient::onSubscribeResponse(const rapidjson::Value &result
|
|||
}
|
||||
|
||||
setExtraNonce(result.GetArray()[1]);
|
||||
|
||||
if (m_pool.isNicehash()) {
|
||||
using namespace rapidjson;
|
||||
Document doc(kObjectType);
|
||||
Value params(kArrayType);
|
||||
JsonRequest::create(doc, m_sequence, "mining.extranonce.subscribe", params);
|
||||
send(doc);
|
||||
}
|
||||
} catch (const std::exception &ex) {
|
||||
LOG_ERR("%s " RED("%s"), tag(), ex.what());
|
||||
|
||||
|
|
|
@ -74,6 +74,9 @@ const char *Pool::kUrl = "url";
|
|||
const char *Pool::kUser = "user";
|
||||
|
||||
|
||||
const char *Pool::kNicehashHost = "nicehash.com";
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -94,7 +97,7 @@ xmrig::Pool::Pool(const char *host, uint16_t port, const char *user, const char
|
|||
m_pollInterval(kDefaultPollInterval),
|
||||
m_url(host, port, tls)
|
||||
{
|
||||
m_flags.set(FLAG_NICEHASH, nicehash);
|
||||
m_flags.set(FLAG_NICEHASH, nicehash || strstr(host, kNicehashHost));
|
||||
m_flags.set(FLAG_TLS, tls);
|
||||
}
|
||||
|
||||
|
@ -119,7 +122,7 @@ xmrig::Pool::Pool(const rapidjson::Value &object) :
|
|||
m_proxy = Json::getValue(object, kSOCKS5);
|
||||
|
||||
m_flags.set(FLAG_ENABLED, Json::getBool(object, kEnabled, true));
|
||||
m_flags.set(FLAG_NICEHASH, Json::getBool(object, kNicehash));
|
||||
m_flags.set(FLAG_NICEHASH, Json::getBool(object, kNicehash) || m_url.host().contains(kNicehashHost));
|
||||
m_flags.set(FLAG_TLS, Json::getBool(object, kTls) || m_url.isTLS());
|
||||
|
||||
if (m_daemon.isValid()) {
|
||||
|
|
|
@ -71,6 +71,7 @@ public:
|
|||
static const char *kTls;
|
||||
static const char *kUrl;
|
||||
static const char *kUser;
|
||||
static const char *kNicehashHost;
|
||||
|
||||
constexpr static int kKeepAliveTimeout = 60;
|
||||
constexpr static uint16_t kDefaultPort = 3333;
|
||||
|
|
Loading…
Reference in a new issue