diff --git a/src/mining.cpp b/src/mining.cpp index d96709a..3aabdb8 100644 --- a/src/mining.cpp +++ b/src/mining.cpp @@ -199,6 +199,7 @@ void runStratumWorker(void *name) { case MINING_SET_DIFFICULTY: parse_mining_set_difficulty(line, currentPoolDifficulty); mMiner.poolDifficulty = currentPoolDifficulty; break; + case STRATUM_SUCCESS: Serial.println(" Parsed JSON: Success"); break; default: Serial.println(" Parsed JSON: unknown"); break; } diff --git a/src/stratum.cpp b/src/stratum.cpp index 4970656..00d72a4 100644 --- a/src/stratum.cpp +++ b/src/stratum.cpp @@ -142,8 +142,13 @@ stratum_method parse_mining_method(String line) if (error || checkError(doc)) return STRATUM_PARSE_ERROR; - if (!doc.containsKey("method")) return STRATUM_UNKNOWN; - + if (!doc.containsKey("method")) { + // "error":null means success + if (doc["error"].isNull()) + return STRATUM_SUCCESS; + else + return STRATUM_UNKNOWN; + } stratum_method result = STRATUM_UNKNOWN; if (strcmp("mining.notify", (const char*) doc["method"]) == 0) { diff --git a/src/stratum.h b/src/stratum.h index 44f65de..d8110e7 100644 --- a/src/stratum.h +++ b/src/stratum.h @@ -38,6 +38,7 @@ typedef struct { } mining_job; typedef enum { + STRATUM_SUCCESS, STRATUM_UNKNOWN, STRATUM_PARSE_ERROR, MINING_NOTIFY,