Browse Source

Display the best diff share submitted so far.

nfactor-troky
Con Kolivas 12 years ago
parent
commit
a6cb920a9e
  1. 12
      cgminer.c

12
cgminer.c

@ -219,6 +219,8 @@ char *current_fullhash; @@ -219,6 +219,8 @@ char *current_fullhash;
static char datestamp[40];
static char blocktime[30];
struct timeval block_timeval;
static char best_share[6]="0";
static uint64_t best_diff = 0;
struct block {
char hash[37];
@ -1587,7 +1589,7 @@ static void curses_print_status(void) @@ -1587,7 +1589,7 @@ static void curses_print_status(void)
pool->rpc_url, have_longpoll ? "": "out", pool->rpc_user);
}
wclrtoeol(statuswin);
mvwprintw(statuswin, 5, 0, " Block: %s... Started: %s", current_hash, blocktime);
mvwprintw(statuswin, 5, 0, " Block: %s... Started: %s Best diff: %s", current_hash, blocktime, best_share);
mvwhline(statuswin, 6, 0, '-', 80);
mvwhline(statuswin, statusy - 1, 0, '-', 80);
mvwprintw(statuswin, devcursor - 1, 1, "[P]ool management %s[S]ettings [D]isplay options [Q]uit",
@ -1980,6 +1982,10 @@ static uint64_t share_diff(const struct work *work) @@ -1980,6 +1982,10 @@ static uint64_t share_diff(const struct work *work)
if (unlikely(!d64))
d64 = 1;
ret = diffone / d64;
if (ret > best_diff) {
best_diff = ret;
suffix_string(best_diff, best_share, 0);
}
return ret;
}
@ -3143,14 +3149,14 @@ static void set_curblock(char *hexstr, unsigned char *hash) @@ -3143,14 +3149,14 @@ static void set_curblock(char *hexstr, unsigned char *hash)
strcpy(current_block, hexstr);
swap256(hash_swap, hash);
swap256(block_hash_swap, hash+4);
swap256(block_hash_swap, hash + 4);
/* Don't free current_hash directly to avoid dereferencing when read
* elsewhere - and update block_timeval inside the same lock */
mutex_lock(&ch_lock);
gettimeofday(&block_timeval, NULL);
old_hash = current_hash;
current_hash = bin2hex(hash_swap, 16);
current_hash = bin2hex(hash_swap + 2, 12);
free(old_hash);
old_hash = current_fullhash;
current_fullhash = bin2hex(block_hash_swap, 32);

Loading…
Cancel
Save