@@ -680,7 +680,7 @@ void EthStratumClient::processReponse(Json::Value& responseObject)
680
680
_isSuccess = responseObject.get (" error" , Json::Value::null).empty ();
681
681
_errReason = (_isSuccess ? " " : processError (responseObject));
682
682
_method = responseObject.get (" method" , " " ).asString ();
683
- _isNotification = (_id == unsigned ( 0 ) || _method != " " );
683
+ _isNotification = ( _method != " " || _id == unsigned ( 0 ) );
684
684
685
685
// Notifications of new jobs are like responses to get_work requests
686
686
if (_isNotification && _method == " " && m_conn->StratumMode () == EthStratumClient::ETHPROXY && responseObject[" result" ].isArray ()) {
@@ -1073,24 +1073,29 @@ void EthStratumClient::processReponse(Json::Value& responseObject)
1073
1073
1074
1074
unsigned prmIdx;
1075
1075
1076
- if (m_conn->StratumMode () == EthStratumClient::ETHPROXY) {
1076
+ if (_method == " mining.notify" )
1077
+ {
1077
1078
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
+ */
1083
1083
1084
- jPrm = responseObject.get (" params" , Json::Value::null);
1085
- prmIdx = 1 ;
1084
+ if (m_conn->StratumMode () == EthStratumClient::ETHPROXY && responseObject.isMember (" result" )) {
1086
1085
1087
- }
1086
+ jPrm = responseObject.get (" result" , Json::Value::null);
1087
+ prmIdx = 0 ;
1088
+ }
1089
+ else
1090
+ {
1088
1091
1092
+ jPrm = responseObject.get (" params" , Json::Value::null);
1093
+ prmIdx = 1 ;
1089
1094
1090
- if (_method == " mining.notify" )
1091
- {
1095
+ }
1092
1096
1093
- if (jPrm.isArray ())
1097
+
1098
+ if (jPrm.isArray () && !jPrm.empty ())
1094
1099
{
1095
1100
string job = jPrm.get ((Json::Value::ArrayIndex)0 , " " ).asString ();
1096
1101
0 commit comments