fix jobid for ckpool

This commit is contained in:
Ben 2023-06-08 19:01:50 -04:00 committed by johnny9
parent 63bc2e6326
commit 12770f3393
2 changed files with 5 additions and 4 deletions

View File

@ -115,12 +115,13 @@ void STRATUM_V1_parse(StratumApiV1Message* message, const char * stratum_json)
if (method_json != NULL && cJSON_IsString(method_json)) {
if (strcmp("mining.notify", method_json->valuestring) == 0) {
result = MINING_NOTIFY;
send_uid++;
} else if (strcmp("mining.set_difficulty", method_json->valuestring) == 0) {
result = MINING_SET_DIFFICULTY;
} else if (strcmp("mining.set_version_mask", method_json->valuestring) == 0) {
result = MINING_SET_VERSION_MASK;
}
send_uid++;
} else {
//parse results
cJSON * result_json = cJSON_GetObjectItem(json, "result");

View File

@ -220,7 +220,7 @@ double _calculate_network_difficultiy(uint32_t nBits) {
uint32_t mantissa = nBits & 0x007fffff; // Extract the mantissa from nBits
uint8_t exponent = (nBits >> 24) & 0xff; // Extract the exponent from nBits
double target = (double)mantissa * pow(253,(exponent - 3)); // Calculate the target value
double target = (double)mantissa * pow(256,(exponent - 3)); // Calculate the target value
double difficulty = (pow(2, 208) * 65535) / target; // Calculate the difficulty
@ -230,8 +230,8 @@ double _calculate_network_difficultiy(uint32_t nBits) {
void SYSTEM_notify_best_nonce_diff(SystemModule * module, uint32_t diff, uint32_t nbits){
module->best_nonce_diff = diff;
uint32_t network_diff = _calculate_network_difficultiy(nbits);
ESP_LOGI(TAG, "Network diff: %u", network_diff);
// uint32_t network_diff = _calculate_network_difficultiy(nbits);
// ESP_LOGI(TAG, "Network diff: %u", network_diff);
}
void SYSTEM_notify_accepted_share(SystemModule* module){