system diff calculations

This commit is contained in:
Ben 2023-06-09 13:29:26 -04:00 committed by johnny9
parent 4eac4e8cf9
commit d9da5dd52d
3 changed files with 6 additions and 6 deletions

View File

@ -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);
}

View File

@ -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_ */

View File

@ -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,