stratum_api: add method to check if previous work should be abandoned

This commit is contained in:
johnny9
2023-05-07 12:10:20 -04:00
parent 9b9a218f6e
commit f80805f53a
4 changed files with 29 additions and 2 deletions

View File

@ -229,4 +229,13 @@ int auth_to_stratum(int socket, const char * username)
free(line);
return 1;
}
}
int should_abandon_work(const char * mining_notify_json_str)
{
cJSON * root = cJSON_Parse(mining_notify_json_str);
cJSON * params = cJSON_GetObjectItem(root, "params");
int value = cJSON_IsTrue(cJSON_GetArrayItem(params, 8));
cJSON_Delete(root);
return value;
}