From d9da5dd52d18936d31048a975c0b63e7947ee74d Mon Sep 17 00:00:00 2001 From: Ben Date: Fri, 9 Jun 2023 13:29:26 -0400 Subject: [PATCH] system diff calculations --- main/system.c | 6 +++--- main/system.h | 4 ++-- main/tasks/asic_task.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/main/system.c b/main/system.c index fa480f94..8b0985c6 100644 --- a/main/system.c +++ b/main/system.c @@ -252,7 +252,7 @@ void SYSTEM_notify_mining_started(SystemModule* module){ module->duration_start = esp_timer_get_time(); } -void SYSTEM_notify_found_nonce(SystemModule* module, double nonce_diff, uint32_t nbits){ +void SYSTEM_notify_found_nonce(SystemModule* module, double pool_diff, double found_diff, uint32_t nbits){ @@ -262,7 +262,7 @@ void SYSTEM_notify_found_nonce(SystemModule* module, double nonce_diff, uint32_t // hashrate = (nonce_difficulty * 2^32) / time_to_find - module->historical_hashrate[module->historical_hashrate_rolling_index] = nonce_diff; + module->historical_hashrate[module->historical_hashrate_rolling_index] = pool_diff; module->historical_hashrate_time_stamps[module->historical_hashrate_rolling_index] = esp_timer_get_time(); module->historical_hashrate_rolling_index = (module->historical_hashrate_rolling_index + 1) % HISTORY_LENGTH; @@ -295,7 +295,7 @@ void SYSTEM_notify_found_nonce(SystemModule* module, double nonce_diff, uint32_t // logArrayContents(historical_hashrate, HISTORY_LENGTH); // logArrayContents(historical_hashrate_time_stamps, HISTORY_LENGTH); - _check_for_best_diff(module, nonce_diff, 0); + _check_for_best_diff(module, found_diff, 0); } diff --git a/main/system.h b/main/system.h index 66378d04..939b613c 100644 --- a/main/system.h +++ b/main/system.h @@ -23,8 +23,8 @@ void SYSTEM_task(void *parameters); void SYSTEM_notify_accepted_share(SystemModule* module); void SYSTEM_notify_rejected_share(SystemModule* module); -void SYSTEM_notify_found_nonce(SystemModule* module, double nonce_diff, uint32_t nbits); +void SYSTEM_notify_found_nonce(SystemModule* module, double pool_diff, double found_diff, uint32_t nbits); void SYSTEM_notify_mining_started(SystemModule* module); -void SYSTEM_notify_best_nonce_diff(SystemModule* module, uint32_t best_nonce_diff, uint32_t nbits); + #endif /* SYSTEM_H_ */ diff --git a/main/tasks/asic_task.c b/main/tasks/asic_task.c index 05f769c6..4c4d977b 100644 --- a/main/tasks/asic_task.c +++ b/main/tasks/asic_task.c @@ -126,7 +126,7 @@ void ASIC_task(void * pvParameters) if (nonce_diff > active_jobs[nonce.job_id]->pool_diff) { - SYSTEM_notify_found_nonce(&GLOBAL_STATE->SYSTEM_MODULE, active_jobs[nonce.job_id]->pool_diff, next_bm_job->target); + SYSTEM_notify_found_nonce(&GLOBAL_STATE->SYSTEM_MODULE, active_jobs[nonce.job_id]->pool_diff, nonce_diff, next_bm_job->target); STRATUM_V1_submit_share( GLOBAL_STATE->sock,