Merge pull request #107 from golden-guy/fix/parse-stratum-success
Miner cosmetics
This commit is contained in:
commit
5e45ed0f49
@ -141,6 +141,8 @@ void runStratumWorker(void *name) {
|
||||
|
||||
if(!isMinerSuscribed){
|
||||
|
||||
//Stop miner current jobs
|
||||
mMiner.inRun = false;
|
||||
mWorker = init_mining_subscribe();
|
||||
|
||||
// STEP 1: Pool server connection (SUBSCRIBE)
|
||||
@ -197,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;
|
||||
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -38,6 +38,7 @@ typedef struct {
|
||||
} mining_job;
|
||||
|
||||
typedef enum {
|
||||
STRATUM_SUCCESS,
|
||||
STRATUM_UNKNOWN,
|
||||
STRATUM_PARSE_ERROR,
|
||||
MINING_NOTIFY,
|
||||
|
Loading…
Reference in New Issue
Block a user