Skip to content
This repository was archived by the owner on Apr 24, 2022. It is now read-only.

Commit 3559522

Browse files
committedJul 10, 2018
Nanopool autodetection
Workaround to nanopool wrong stratum implementation.
1 parent 7669783 commit 3559522

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed
 

‎libpoolprotocols/stratum/EthStratumClient.cpp

+18-13
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ void EthStratumClient::processReponse(Json::Value& responseObject)
680680
_isSuccess = responseObject.get("error", Json::Value::null).empty();
681681
_errReason = (_isSuccess ? "" : processError(responseObject));
682682
_method = responseObject.get("method", "").asString();
683-
_isNotification = (_id == unsigned(0) || _method != "");
683+
_isNotification = ( _method != "" || _id == unsigned(0) );
684684

685685
// Notifications of new jobs are like responses to get_work requests
686686
if (_isNotification && _method == "" && m_conn->StratumMode() == EthStratumClient::ETHPROXY && responseObject["result"].isArray()) {
@@ -1073,24 +1073,29 @@ void EthStratumClient::processReponse(Json::Value& responseObject)
10731073

10741074
unsigned prmIdx;
10751075

1076-
if (m_conn->StratumMode() == EthStratumClient::ETHPROXY) {
1076+
if (_method == "mining.notify")
1077+
{
10771078

1078-
jPrm = responseObject.get("result", Json::Value::null);
1079-
prmIdx = 0;
1080-
}
1081-
else
1082-
{
1079+
/*
1080+
Workaraound for Nanopool wrong implementation
1081+
see issue # 1348
1082+
*/
10831083

1084-
jPrm = responseObject.get("params", Json::Value::null);
1085-
prmIdx = 1;
1084+
if (m_conn->StratumMode() == EthStratumClient::ETHPROXY && responseObject.isMember("result")) {
10861085

1087-
}
1086+
jPrm = responseObject.get("result", Json::Value::null);
1087+
prmIdx = 0;
1088+
}
1089+
else
1090+
{
10881091

1092+
jPrm = responseObject.get("params", Json::Value::null);
1093+
prmIdx = 1;
10891094

1090-
if (_method == "mining.notify")
1091-
{
1095+
}
10921096

1093-
if (jPrm.isArray())
1097+
1098+
if (jPrm.isArray() && !jPrm.empty())
10941099
{
10951100
string job = jPrm.get((Json::Value::ArrayIndex)0, "").asString();
10961101

0 commit comments

Comments
 (0)
This repository has been archived.