|
|
@ -176,7 +176,7 @@ pthread_mutex_t cgusb_lock; |
|
|
|
pthread_mutex_t hash_lock; |
|
|
|
pthread_mutex_t hash_lock; |
|
|
|
static pthread_mutex_t *stgd_lock; |
|
|
|
static pthread_mutex_t *stgd_lock; |
|
|
|
pthread_mutex_t console_lock; |
|
|
|
pthread_mutex_t console_lock; |
|
|
|
pthread_mutex_t ch_lock; |
|
|
|
cglock_t ch_lock; |
|
|
|
static pthread_rwlock_t blk_lock; |
|
|
|
static pthread_rwlock_t blk_lock; |
|
|
|
static pthread_mutex_t sshare_lock; |
|
|
|
static pthread_mutex_t sshare_lock; |
|
|
|
|
|
|
|
|
|
|
@ -225,8 +225,11 @@ const |
|
|
|
bool curses_active; |
|
|
|
bool curses_active; |
|
|
|
|
|
|
|
|
|
|
|
static char current_block[40]; |
|
|
|
static char current_block[40]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Protected by ch_lock */ |
|
|
|
static char *current_hash; |
|
|
|
static char *current_hash; |
|
|
|
char *current_fullhash; |
|
|
|
char *current_fullhash; |
|
|
|
|
|
|
|
|
|
|
|
static char datestamp[40]; |
|
|
|
static char datestamp[40]; |
|
|
|
static char blocktime[32]; |
|
|
|
static char blocktime[32]; |
|
|
|
struct timeval block_timeval; |
|
|
|
struct timeval block_timeval; |
|
|
@ -1998,8 +2001,10 @@ static void curses_print_status(void) |
|
|
|
pool->has_gbt ? "GBT" : "LP", pool->rpc_user); |
|
|
|
pool->has_gbt ? "GBT" : "LP", pool->rpc_user); |
|
|
|
} |
|
|
|
} |
|
|
|
wclrtoeol(statuswin); |
|
|
|
wclrtoeol(statuswin); |
|
|
|
|
|
|
|
cg_rlock(&ch_lock); |
|
|
|
mvwprintw(statuswin, 5, 0, " Block: %s... Diff:%s Started: %s Best share: %s ", |
|
|
|
mvwprintw(statuswin, 5, 0, " Block: %s... Diff:%s Started: %s Best share: %s ", |
|
|
|
current_hash, block_diff, blocktime, best_share); |
|
|
|
current_hash, block_diff, blocktime, best_share); |
|
|
|
|
|
|
|
cg_runlock(&ch_lock); |
|
|
|
mvwhline(statuswin, 6, 0, '-', 80); |
|
|
|
mvwhline(statuswin, 6, 0, '-', 80); |
|
|
|
mvwhline(statuswin, statusy - 1, 0, '-', 80); |
|
|
|
mvwhline(statuswin, statusy - 1, 0, '-', 80); |
|
|
|
mvwprintw(statuswin, devcursor - 1, 1, "[P]ool management %s[S]ettings [D]isplay options [Q]uit", |
|
|
|
mvwprintw(statuswin, devcursor - 1, 1, "[P]ool management %s[S]ettings [D]isplay options [Q]uit", |
|
|
@ -3555,27 +3560,20 @@ static void set_curblock(char *hexstr, unsigned char *hash) |
|
|
|
{ |
|
|
|
{ |
|
|
|
unsigned char hash_swap[32]; |
|
|
|
unsigned char hash_swap[32]; |
|
|
|
unsigned char block_hash_swap[32]; |
|
|
|
unsigned char block_hash_swap[32]; |
|
|
|
char *old_hash; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
strcpy(current_block, hexstr); |
|
|
|
strcpy(current_block, hexstr); |
|
|
|
swap256(hash_swap, hash); |
|
|
|
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
|
|
|
|
cg_wlock(&ch_lock); |
|
|
|
* elsewhere - and update block_timeval inside the same lock */ |
|
|
|
|
|
|
|
mutex_lock(&ch_lock); |
|
|
|
|
|
|
|
gettimeofday(&block_timeval, NULL); |
|
|
|
gettimeofday(&block_timeval, NULL); |
|
|
|
old_hash = current_hash; |
|
|
|
free(current_hash); |
|
|
|
current_hash = bin2hex(hash_swap + 2, 8); |
|
|
|
current_hash = bin2hex(hash_swap + 2, 8); |
|
|
|
free(old_hash); |
|
|
|
free(current_fullhash); |
|
|
|
old_hash = current_fullhash; |
|
|
|
|
|
|
|
current_fullhash = bin2hex(block_hash_swap, 32); |
|
|
|
current_fullhash = bin2hex(block_hash_swap, 32); |
|
|
|
free(old_hash); |
|
|
|
|
|
|
|
mutex_unlock(&ch_lock); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
get_timestamp(blocktime, &block_timeval); |
|
|
|
get_timestamp(blocktime, &block_timeval); |
|
|
|
|
|
|
|
|
|
|
|
applog(LOG_INFO, "New block: %s... diff %s", current_hash, block_diff); |
|
|
|
applog(LOG_INFO, "New block: %s... diff %s", current_hash, block_diff); |
|
|
|
|
|
|
|
cg_wunlock(&ch_lock); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* Search to see if this string is from a block that has been seen before */ |
|
|
|
/* Search to see if this string is from a block that has been seen before */ |
|
|
@ -7038,7 +7036,7 @@ int main(int argc, char *argv[]) |
|
|
|
cglock_init(&control_lock); |
|
|
|
cglock_init(&control_lock); |
|
|
|
mutex_init(&stats_lock); |
|
|
|
mutex_init(&stats_lock); |
|
|
|
mutex_init(&sharelog_lock); |
|
|
|
mutex_init(&sharelog_lock); |
|
|
|
mutex_init(&ch_lock); |
|
|
|
cglock_init(&ch_lock); |
|
|
|
mutex_init(&sshare_lock); |
|
|
|
mutex_init(&sshare_lock); |
|
|
|
rwlock_init(&blk_lock); |
|
|
|
rwlock_init(&blk_lock); |
|
|
|
rwlock_init(&netacc_lock); |
|
|
|
rwlock_init(&netacc_lock); |
|
|
|