Skip to content

Commit

Permalink
best_nonce_diff as uint64_t
Browse files Browse the repository at this point in the history
  • Loading branch information
MoellerDi committed Mar 29, 2024
1 parent 37b9194 commit d049235
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions main/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ static void _init_system(GlobalState * global_state, SystemModule * module)
module->pool_port = nvs_config_get_u16(NVS_CONFIG_STRATUM_PORT, CONFIG_STRATUM_PORT);

// set the best diff string
_suffix_string((uint64_t) module->best_nonce_diff, module->best_diff_string, DIFF_STRING_SIZE, 0);
_suffix_string(module->best_nonce_diff, module->best_diff_string, DIFF_STRING_SIZE, 0);

// set the ssid string to blank
memset(module->ssid, 0, 20);
Expand Down Expand Up @@ -269,12 +269,12 @@ static double _calculate_network_difficulty(uint32_t nBits)

static void _check_for_best_diff(SystemModule * module, double diff, uint32_t nbits)
{
if (diff <= module->best_nonce_diff) {
if ((uint64_t) diff <= module->best_nonce_diff) {
return;
}
module->best_nonce_diff = diff;
module->best_nonce_diff = (uint64_t) diff;

nvs_config_set_u64(NVS_CONFIG_BEST_DIFF, (uint64_t) module->best_nonce_diff);
nvs_config_set_u64(NVS_CONFIG_BEST_DIFF, module->best_nonce_diff);

// make the best_nonce_diff into a string
_suffix_string((uint64_t) diff, module->best_diff_string, DIFF_STRING_SIZE, 0);
Expand Down
2 changes: 1 addition & 1 deletion main/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ typedef struct
uint16_t shares_rejected;
int screen_page;
char oled_buf[20];
double best_nonce_diff;
uint64_t best_nonce_diff;
char best_diff_string[DIFF_STRING_SIZE];
bool FOUND_BLOCK;
bool startup_done;
Expand Down

0 comments on commit d049235

Please sign in to comment.