Display the best diff share submitted so far.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
diff --git a/cgminer.c b/cgminer.c
index cc7f209..99f7f58 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -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)
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)
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)
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);