Skip to content

Commit

Permalink
fix Best Difficulty can not be > 4.29G (#155)
Browse files Browse the repository at this point in the history
* fix best_nonce_diff, uint32_t is too small

* best_nonce_diff as uint64_t
  • Loading branch information
MoellerDi authored Mar 29, 2024
1 parent 0bbf99b commit 6283a68
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions main/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,10 @@ 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, module->best_nonce_diff);

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];
uint32_t 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 6283a68

Please sign in to comment.