mirror of
https://github.com/skot/ESP-Miner.git
synced 2025-03-26 17:51:45 +01:00
stratum: parse version-rolling config result
This commit is contained in:
parent
c7de2c0795
commit
bc326499ea
@ -16,7 +16,8 @@ typedef enum {
|
||||
MINING_NOTIFY,
|
||||
MINING_SET_DIFFICULTY,
|
||||
MINING_SET_VERSION_MASK,
|
||||
STRATUM_RESULT
|
||||
STRATUM_RESULT,
|
||||
STRATUM_RESULT_VERSION_MASK
|
||||
} stratum_method;
|
||||
|
||||
typedef struct {
|
||||
|
@ -128,7 +128,6 @@ void STRATUM_V1_parse(StratumApiV1Message* message, const char * stratum_json)
|
||||
} else if (strcmp("mining.set_version_mask", method_json->valuestring) == 0) {
|
||||
result = MINING_SET_VERSION_MASK;
|
||||
}
|
||||
|
||||
} else {
|
||||
//parse results
|
||||
cJSON * result_json = cJSON_GetObjectItem(json, "result");
|
||||
@ -136,15 +135,18 @@ void STRATUM_V1_parse(StratumApiV1Message* message, const char * stratum_json)
|
||||
|
||||
result = STRATUM_RESULT;
|
||||
|
||||
|
||||
|
||||
bool response_success = false;
|
||||
if (result_json != NULL && cJSON_IsTrue(result_json)) {
|
||||
response_success = true;
|
||||
}
|
||||
|
||||
message->response_success = response_success;
|
||||
|
||||
} else {
|
||||
cJSON * mask = cJSON_GetObjectItem(result_json, "version-rolling.mask");
|
||||
if (mask != NULL) {
|
||||
result = STRATUM_RESULT_VERSION_MASK;
|
||||
message->version_mask = strtoul(mask->valuestring, NULL, 16);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,12 +127,12 @@ void stratum_task(void * pvParameters)
|
||||
ESP_LOGI(TAG, "Set stratum difficulty: %d", SYSTEM_TASK_MODULE.stratum_difficulty);
|
||||
}
|
||||
|
||||
} else if (stratum_api_v1_message.method == MINING_SET_VERSION_MASK) {
|
||||
} else if (stratum_api_v1_message.method == MINING_SET_VERSION_MASK || stratum_api_v1_message.method == STRATUM_RESULT_VERSION_MASK) {
|
||||
//1fffe000
|
||||
ESP_LOGI(TAG, "Set version mask: %08x", stratum_api_v1_message.version_mask);
|
||||
GLOBAL_STATE->version_mask = stratum_api_v1_message.version_mask;
|
||||
|
||||
} else if (stratum_api_v1_message.method == STRATUM_RESULT) {
|
||||
|
||||
if (stratum_api_v1_message.response_success) {
|
||||
ESP_LOGI(TAG, "message result accepted");
|
||||
SYSTEM_notify_accepted_share(&GLOBAL_STATE->SYSTEM_MODULE);
|
||||
@ -140,10 +140,7 @@ void stratum_task(void * pvParameters)
|
||||
ESP_LOGE(TAG, "message result rejected");
|
||||
SYSTEM_notify_rejected_share(&GLOBAL_STATE->SYSTEM_MODULE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (GLOBAL_STATE->sock != -1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user