Merge pull request #1732 from SChernykh/evo
Fixed NiceHash disconnects for KawPow
This commit is contained in:
commit
77ca380697
3 changed files with 30 additions and 2 deletions
|
@ -145,6 +145,22 @@ void xmrig::EthStratumClient::parseNotification(const char *method, const rapidj
|
||||||
return;
|
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 (strcmp(method, "mining.notify") == 0) {
|
||||||
if (!params.IsArray()) {
|
if (!params.IsArray()) {
|
||||||
LOG_ERR("%s " RED("invalid mining.notify notification: params is not an array"), tag());
|
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]);
|
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) {
|
} catch (const std::exception &ex) {
|
||||||
LOG_ERR("%s " RED("%s"), tag(), ex.what());
|
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::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_pollInterval(kDefaultPollInterval),
|
||||||
m_url(host, port, tls)
|
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);
|
m_flags.set(FLAG_TLS, tls);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +122,7 @@ xmrig::Pool::Pool(const rapidjson::Value &object) :
|
||||||
m_proxy = Json::getValue(object, kSOCKS5);
|
m_proxy = Json::getValue(object, kSOCKS5);
|
||||||
|
|
||||||
m_flags.set(FLAG_ENABLED, Json::getBool(object, kEnabled, true));
|
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());
|
m_flags.set(FLAG_TLS, Json::getBool(object, kTls) || m_url.isTLS());
|
||||||
|
|
||||||
if (m_daemon.isValid()) {
|
if (m_daemon.isValid()) {
|
||||||
|
|
|
@ -71,6 +71,7 @@ public:
|
||||||
static const char *kTls;
|
static const char *kTls;
|
||||||
static const char *kUrl;
|
static const char *kUrl;
|
||||||
static const char *kUser;
|
static const char *kUser;
|
||||||
|
static const char *kNicehashHost;
|
||||||
|
|
||||||
constexpr static int kKeepAliveTimeout = 60;
|
constexpr static int kKeepAliveTimeout = 60;
|
||||||
constexpr static uint16_t kDefaultPort = 3333;
|
constexpr static uint16_t kDefaultPort = 3333;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue