fix Best Difficulty can not be > 4.29G (#155)

* fix best_nonce_diff, uint32_t is too small

* best_nonce_diff as uint64_t
This commit is contained in:
MoellerDi
2024-03-29 15:37:19 +01:00
committed by GitHub
parent 0bbf99b88c
commit 6283a68d4b
2 changed files with 3 additions and 3 deletions

View File

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

View File

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