@ -210,7 +210,7 @@ static struct pool *currentpool = NULL;
@@ -210,7 +210,7 @@ static struct pool *currentpool = NULL;
int total_pools , enabled_pools ;
enum pool_strategy pool_strategy = POOL_FAILOVER ;
int opt_rotate_period ;
static int total_urls , total_users , total_passes , total_userpasses ;
static int total_urls , total_users , total_passes , total_userpasses , total_poolnames ;
static
# ifndef HAVE_CURSES
@ -507,6 +507,9 @@ struct pool *add_pool(void)
@@ -507,6 +507,9 @@ struct pool *add_pool(void)
if ( ! pool )
quit ( 1 , " Failed to malloc pool in add_pool " ) ;
pool - > pool_no = pool - > prio = total_pools ;
char buf [ 32 ] ;
sprintf ( buf , " Pool %d " , pool - > pool_no ) ;
pool - > poolname = strdup ( buf ) ;
pools = realloc ( pools , sizeof ( struct pool * ) * ( total_pools + 2 ) ) ;
pools [ total_pools + + ] = pool ;
mutex_init ( & pool - > pool_lock ) ;
@ -724,6 +727,20 @@ static char *set_url(char *arg)
@@ -724,6 +727,20 @@ static char *set_url(char *arg)
return NULL ;
}
static char * set_poolname ( char * arg )
{
struct pool * pool ;
total_poolnames + + ;
if ( total_poolnames > total_pools )
add_pool ( ) ;
pool = pools [ total_poolnames - 1 ] ;
opt_set_charp ( arg , & pool - > poolname ) ;
return NULL ;
}
static char * set_quota ( char * arg )
{
char * semicolon = strchr ( arg , ' ; ' ) , * url ;
@ -747,7 +764,7 @@ static char *set_quota(char *arg)
@@ -747,7 +764,7 @@ static char *set_quota(char *arg)
pool = add_url ( ) ;
setup_url ( pool , url ) ;
pool - > quota = quota ;
applog ( LOG_INFO , " Setting pool %d to quota %d " , pool - > pool_no , pool - > quota ) ;
applog ( LOG_INFO , " Setting %s to quota %d " , pool - > poolname , pool - > quota ) ;
adjust_quota_gcd ( ) ;
return NULL ;
@ -1115,6 +1132,9 @@ static struct opt_table opt_config_table[] = {
@@ -1115,6 +1132,9 @@ static struct opt_table opt_config_table[] = {
OPT_WITHOUT_ARG ( " --per-device-stats " ,
opt_set_bool , & want_per_device_stats ,
" Force verbose mode and output per-device statistics " ) ,
OPT_WITH_ARG ( " --poolname " ,
set_poolname , NULL , NULL ,
" Name of pool. " ) ,
OPT_WITHOUT_ARG ( " --protocol-dump|-P " ,
opt_set_bool , & opt_protocol ,
" Verbose dump of protocol-level activities " ) ,
@ -1581,20 +1601,17 @@ static void update_gbt(struct pool *pool)
@@ -1581,20 +1601,17 @@ static void update_gbt(struct pool *pool)
total_getworks + + ;
pool - > getwork_requested + + ;
if ( rc ) {
applog ( LOG_DEBUG , " Successfully retrieved and updated GBT from pool %u %s " ,
pool - > pool_no , pool - > rpc_url ) ;
applog ( LOG_DEBUG , " Successfully retrieved and updated GBT from %s " , pool - > poolname ) ;
cgtime ( & pool - > tv_idle ) ;
if ( pool = = current_pool ( ) )
opt_work_update = true ;
} else {
applog ( LOG_DEBUG , " Successfully retrieved but FAILED to decipher GBT from pool %u %s " ,
pool - > pool_no , pool - > rpc_url ) ;
applog ( LOG_DEBUG , " Successfully retrieved but FAILED to decipher GBT from %s " , pool - > poolname ) ;
}
json_decref ( val ) ;
free_work ( work ) ;
} else {
applog ( LOG_DEBUG , " FAILED to update GBT from pool %u %s " ,
pool - > pool_no , pool - > rpc_url ) ;
applog ( LOG_DEBUG , " FAILED to update GBT from %s " , pool - > poolname ) ;
}
curl_easy_cleanup ( curl ) ;
}
@ -2307,10 +2324,10 @@ share_result(json_t *val, json_t *res, json_t *err, const struct work *work,
@@ -2307,10 +2324,10 @@ share_result(json_t *val, json_t *res, json_t *err, const struct work *work,
pool - > last_share_diff = work - > work_difficulty ;
applog ( LOG_DEBUG , " PROOF OF WORK RESULT: true (yay!!!) " ) ;
if ( ! QUIET ) {
if ( total_pools > 1 )
applog ( LOG_NOTICE , " Accepted %s %s %d pool %d %s%s " ,
hashshow , cgpu - > drv - > name , cgpu - > device_id , work - > pool - > pool_no , resubmit ? " (resubmit) " : " " , worktime ) ;
else
if ( total_pools > 1 ) {
applog ( LOG_NOTICE , " Accepted %s %s %d at %s %s%s " ,
hashshow , cgpu - > drv - > name , cgpu - > device_id , pool - > poolname , resubmit ? " (resubmit) " : " " , worktime ) ;
} else
applog ( LOG_NOTICE , " Accepted %s %s %d %s%s " ,
hashshow , cgpu - > drv - > name , cgpu - > device_id , resubmit ? " (resubmit) " : " " , worktime ) ;
}
@ -2326,7 +2343,7 @@ share_result(json_t *val, json_t *res, json_t *err, const struct work *work,
@@ -2326,7 +2343,7 @@ share_result(json_t *val, json_t *res, json_t *err, const struct work *work,
* This will only happen with the work returned from a
* longpoll */
if ( unlikely ( pool - > enabled = = POOL_REJECTING ) ) {
applog ( LOG_WARNING , " Rejecting pool %d now accepting shares, re-enabling! " , pool - > pool_no ) ;
applog ( LOG_WARNING , " Rejecting %s now accepting shares, re-enabling! " , pool - > poolname ) ;
enable_pool ( pool ) ;
switch_pools ( NULL ) ;
}
@ -2353,7 +2370,7 @@ share_result(json_t *val, json_t *res, json_t *err, const struct work *work,
@@ -2353,7 +2370,7 @@ share_result(json_t *val, json_t *res, json_t *err, const struct work *work,
strcpy ( reason , " " ) ;
if ( total_pools > 1 )
snprintf ( where , sizeof ( where ) , " pool %d " , work - > pool - > pool_no ) ;
snprintf ( where , sizeof ( where ) , " %s " , work - > pool - > poolname ) ;
else
strcpy ( where , " " ) ;
@ -2395,8 +2412,8 @@ share_result(json_t *val, json_t *res, json_t *err, const struct work *work,
@@ -2395,8 +2412,8 @@ share_result(json_t *val, json_t *res, json_t *err, const struct work *work,
double utility = total_accepted / total_secs * 60 ;
if ( pool - > seq_rejects > utility * 3 ) {
applog ( LOG_WARNING , " Pool %d rejected %d sequential shares, disabling!" ,
pool - > pool_no , pool - > seq_rejects ) ;
applog ( LOG_WARNING , " %s rejected %d sequential shares, disabling!" ,
pool - > poolname , pool - > seq_rejects ) ;
reject_pool ( pool ) ;
if ( pool = = current_pool ( ) )
switch_pools ( NULL ) ;
@ -2525,15 +2542,15 @@ static bool submit_upstream_work(struct work *work, CURL *curl, bool resubmit)
@@ -2525,15 +2542,15 @@ static bool submit_upstream_work(struct work *work, CURL *curl, bool resubmit)
total_ro + + ;
pool - > remotefail_occasions + + ;
if ( opt_lowmem ) {
applog ( LOG_WARNING , " Pool %d communication failure, discarding shares" , pool - > pool_no ) ;
applog ( LOG_WARNING , " %s communication failure, discarding shares" , pool - > poolname ) ;
goto out ;
}
applog ( LOG_WARNING , " Pool %d communication failure, caching submissions" , pool - > pool_no ) ;
applog ( LOG_WARNING , " %s communication failure, caching submissions" , pool - > poolname ) ;
}
cgsleep_ms ( 5000 ) ;
goto out ;
} else if ( pool_tclear ( pool , & pool - > submit_fail ) )
applog ( LOG_WARNING , " Pool %d communication resumed, submitting work" , pool - > pool_no ) ;
applog ( LOG_WARNING , " %s communication resumed, submitting work" , pool - > poolname ) ;
res = json_object_get ( val , " result " ) ;
err = json_object_get ( val , " error " ) ;
@ -2786,7 +2803,7 @@ static inline struct pool *select_pool(bool lagging)
@@ -2786,7 +2803,7 @@ static inline struct pool *select_pool(bool lagging)
if ( ! pool )
pool = cp ;
out :
applog ( LOG_DEBUG , " Selecting pool %d for work " , pool - > pool_no ) ;
applog ( LOG_DEBUG , " Selecting %s for work " , pool - > poolname ) ;
return pool ;
}
@ -3092,7 +3109,7 @@ retry:
@@ -3092,7 +3109,7 @@ retry:
mutex_unlock ( & pool - > pool_lock ) ;
if ( recruited )
applog ( LOG_DEBUG , " Recruited curl for pool %d " , pool - > pool_no ) ;
applog ( LOG_DEBUG , " Recruited curl for %s " , pool - > poolname ) ;
return ce ;
}
@ -3174,12 +3191,12 @@ static void *submit_work_thread(void *userdata)
@@ -3174,12 +3191,12 @@ static void *submit_work_thread(void *userdata)
/* submit solution to bitcoin via JSON-RPC */
while ( ! submit_upstream_work ( work , ce - > curl , resubmit ) ) {
if ( opt_lowmem ) {
applog ( LOG_NOTICE , " Pool %d share being discarded to minimise memory cache" , pool - > pool_no ) ;
applog ( LOG_NOTICE , " %s share being discarded to minimise memory cache" , pool - > poolname ) ;
break ;
}
resubmit = true ;
if ( stale_work ( work , true ) ) {
applog ( LOG_NOTICE , " Pool %d share became stale while retrying submit, discarding" , pool - > pool_no ) ;
applog ( LOG_NOTICE , " %s share became stale while retrying submit, discarding" , pool - > poolname ) ;
mutex_lock ( & stats_lock ) ;
total_stale + + ;
@ -3370,10 +3387,10 @@ static void pool_died(struct pool *pool)
@@ -3370,10 +3387,10 @@ static void pool_died(struct pool *pool)
if ( ! pool_tset ( pool , & pool - > idle ) ) {
cgtime ( & pool - > tv_idle ) ;
if ( pool = = current_pool ( ) ) {
applog ( LOG_WARNING , " Pool %d %s not responding!" , pool - > pool_no , pool - > rpc_url ) ;
applog ( LOG_WARNING , " %s %s not responding!" , pool - > poolname , pool - > rpc_url ) ;
switch_pools ( NULL ) ;
} else
applog ( LOG_INFO , " Pool %d %s failed to return work" , pool - > pool_no , pool - > rpc_url ) ;
applog ( LOG_INFO , " %s %s failed to return work" , pool - > poolname , pool - > rpc_url ) ;
}
}
@ -3579,7 +3596,7 @@ void switch_pools(struct pool *selected)
@@ -3579,7 +3596,7 @@ void switch_pools(struct pool *selected)
pool_tset ( pool , & pool - > lagging ) ;
if ( pool ! = last_pool & & pool_strategy ! = POOL_LOADBALANCE & & pool_strategy ! = POOL_BALANCE ) {
applog ( LOG_WARNING , " Switching to pool %d %s " , pool - > pool_no , pool - > rpc_url ) ;
applog ( LOG_WARNING , " Switching to %s " , pool - > poolname ) ;
if ( pool_localgen ( pool ) | | opt_fail_only )
clear_pool_work ( last_pool ) ;
}
@ -3841,14 +3858,12 @@ static bool test_work_current(struct work *work)
@@ -3841,14 +3858,12 @@ static bool test_work_current(struct work *work)
}
work - > work_block = + + work_block ;
if ( work - > longpoll ) {
if ( work - > stratum ) {
applog ( LOG_NOTICE , " Stratum from pool %d detected new block " ,
pool - > pool_no ) ;
applog ( LOG_NOTICE , " Stratum from %s detected new block " , pool - > poolname ) ;
} else {
applog ( LOG_NOTICE , " %sLONGPOLL from pool %d detected new block " ,
work - > gbt ? " GBT " : " " , work - > pool - > pool_no ) ;
applog ( LOG_NOTICE , " %sLONGPOLL from %s detected new block " ,
work - > gbt ? " GBT " : " " , work - > pool - > poolname ) ;
}
} else if ( have_longpoll )
applog ( LOG_NOTICE , " New block detected on network before longpoll " ) ;
@ -3863,12 +3878,12 @@ static bool test_work_current(struct work *work)
@@ -3863,12 +3878,12 @@ static bool test_work_current(struct work *work)
* block . */
if ( memcmp ( bedata , current_block , 32 ) ) {
/* Doesn't match current block. It's stale */
applog ( LOG_DEBUG , " Stale data from pool %d " , pool - > pool_no ) ;
applog ( LOG_DEBUG , " Stale data from %s " , pool - > poolname ) ;
ret = false ;
} else {
/* Work is from new block and pool is up now
* current . */
applog ( LOG_INFO , " Pool %d now up to date" , pool - > pool_no ) ;
applog ( LOG_INFO , " %s now up to date" , pool - > poolname ) ;
memcpy ( pool - > prev_block , bedata , 32 ) ;
}
}
@ -3877,17 +3892,15 @@ static bool test_work_current(struct work *work)
@@ -3877,17 +3892,15 @@ static bool test_work_current(struct work *work)
* accepting shares from it . To maintain fair work distribution
* we work on it anyway . */
if ( memcmp ( bedata , current_block , 32 ) )
applog ( LOG_DEBUG , " Pool %d still on old block" , pool - > pool_no ) ;
applog ( LOG_DEBUG , " %s still on old block" , pool - > poolname ) ;
# endif
if ( work - > longpoll ) {
work - > work_block = + + work_block ;
if ( shared_strategy ( ) | | work - > pool = = current_pool ( ) ) {
if ( work - > stratum ) {
applog ( LOG_NOTICE , " Stratum from pool %d requested work restart " ,
pool - > pool_no ) ;
applog ( LOG_NOTICE , " Stratum from %s requested work restart " , pool - > poolname ) ;
} else {
applog ( LOG_NOTICE , " %sLONGPOLL from pool %d requested work restart " ,
work - > gbt ? " GBT " : " " , work - > pool - > pool_no ) ;
applog ( LOG_NOTICE , " %sLONGPOLL from %s requested work restart " , work - > gbt ? " GBT " : " " , work - > pool - > poolname ) ;
}
restart_threads ( ) ;
}
@ -3929,7 +3942,7 @@ static bool hash_push(struct work *work)
@@ -3929,7 +3942,7 @@ static bool hash_push(struct work *work)
static void stage_work ( struct work * work )
{
applog ( LOG_DEBUG , " Pushing work from pool %d to hash queue " , work - > pool - > pool_no ) ;
applog ( LOG_DEBUG , " Pushing work from %s to hash queue " , work - > pool - > poolname ) ;
work - > work_block = work_block ;
test_work_current ( work ) ;
work - > pool - > works + + ;
@ -4956,7 +4969,7 @@ static bool parse_stratum_response(struct pool *pool, char *s)
@@ -4956,7 +4969,7 @@ static bool parse_stratum_response(struct pool *pool, char *s)
cg_runlock ( & pool - > data_lock ) ;
if ( json_is_true ( res_val ) ) {
applog ( LOG_NOTICE , " Accepted untracked stratum share from pool %d " , pool - > pool_no ) ;
applog ( LOG_NOTICE , " Accepted untracked stratum share from %s " , pool - > poolname ) ;
/* We don't know what device this came from so we can't
* attribute the work to the relevant cgpu */
@ -4967,7 +4980,7 @@ static bool parse_stratum_response(struct pool *pool, char *s)
@@ -4967,7 +4980,7 @@ static bool parse_stratum_response(struct pool *pool, char *s)
pool - > diff_accepted + = pool_diff ;
mutex_unlock ( & stats_lock ) ;
} else {
applog ( LOG_NOTICE , " Rejected untracked stratum share from pool %d " , pool - > pool_no ) ;
applog ( LOG_NOTICE , " Rejected untracked stratum share from %s " , pool - > poolname ) ;
mutex_lock ( & stats_lock ) ;
total_rejected + + ;
@ -5010,7 +5023,7 @@ void clear_stratum_shares(struct pool *pool)
@@ -5010,7 +5023,7 @@ void clear_stratum_shares(struct pool *pool)
mutex_unlock ( & sshare_lock ) ;
if ( cleared ) {
applog ( LOG_WARNING , " Lost %d shares due to stratum disconnect on pool %d " , cleared , pool - > pool_no ) ;
applog ( LOG_WARNING , " Lost %d shares due to stratum disconnect on %s " , cleared , pool - > poolname ) ;
pool - > stale_shares + = cleared ;
total_stale + = cleared ;
pool - > diff_stale + = diff_cleared ;
@ -5097,7 +5110,7 @@ static void stratum_resumed(struct pool *pool)
@@ -5097,7 +5110,7 @@ static void stratum_resumed(struct pool *pool)
if ( ! pool - > stratum_notify )
return ;
if ( pool_tclear ( pool , & pool - > idle ) ) {
applog ( LOG_INFO , " Stratum connection to pool %d resumed " , pool - > pool_no ) ;
applog ( LOG_INFO , " Stratum connection to %s resumed " , pool - > poolname ) ;
pool_resus ( pool ) ;
}
}
@ -5165,12 +5178,12 @@ static void *stratum_rthread(void *userdata)
@@ -5165,12 +5178,12 @@ static void *stratum_rthread(void *userdata)
* assume the connection has been dropped and treat this pool
* as dead */
if ( ! sock_full ( pool ) & & ( sel_ret = select ( pool - > sock + 1 , & rd , NULL , NULL , & timeout ) ) < 1 ) {
applog ( LOG_DEBUG , " Stratum select failed on pool %d with value %d " , pool - > pool_no , sel_ret ) ;
applog ( LOG_DEBUG , " Stratum select failed on %s with value %d " , pool - > poolname , sel_ret ) ;
s = NULL ;
} else
s = recv_line ( pool ) ;
if ( ! s ) {
applog ( LOG_NOTICE , " Stratum connection to pool %d interrupted " , pool - > pool_no ) ;
applog ( LOG_NOTICE , " Stratum connection to %s interrupted " , pool - > poolname ) ;
pool - > getfail_occasions + + ;
total_go + + ;
@ -5256,8 +5269,7 @@ static void *stratum_sthread(void *userdata)
@@ -5256,8 +5269,7 @@ static void *stratum_sthread(void *userdata)
quit ( 1 , " Stratum q returned empty work " ) ;
if ( unlikely ( work - > nonce2_len > 8 ) ) {
applog ( LOG_ERR , " Pool %d asking for inappropriately long nonce2 length %d " ,
pool - > pool_no , ( int ) work - > nonce2_len ) ;
applog ( LOG_ERR , " %s asking for inappropriately long nonce2 length %d " , pool - > poolname , ( int ) work - > nonce2_len ) ;
applog ( LOG_ERR , " Not attempting to submit shares " ) ;
free_work ( work ) ;
continue ;
@ -5287,8 +5299,7 @@ static void *stratum_sthread(void *userdata)
@@ -5287,8 +5299,7 @@ static void *stratum_sthread(void *userdata)
" { \" params \" : [ \" %s \" , \" %s \" , \" %s \" , \" %s \" , \" %s \" ], \" id \" : %d, \" method \" : \" mining.submit \" } " ,
pool - > rpc_user , work - > job_id , nonce2hex , work - > ntime , noncehex , sshare - > id ) ;
applog ( LOG_INFO , " Submitting share %08lx to pool %d " ,
( long unsigned int ) htole32 ( hash32 [ 6 ] ) , pool - > pool_no ) ;
applog ( LOG_INFO , " Submitting share %08lx to %s " , ( long unsigned int ) htole32 ( hash32 [ 6 ] ) , pool - > poolname ) ;
/* Try resubmitting for up to 2 minutes if we fail to submit
* once and the stratum pool nonce1 still matches suggesting
@ -5298,7 +5309,7 @@ static void *stratum_sthread(void *userdata)
@@ -5298,7 +5309,7 @@ static void *stratum_sthread(void *userdata)
if ( likely ( stratum_send ( pool , s , strlen ( s ) ) ) ) {
if ( pool_tclear ( pool , & pool - > submit_fail ) )
applog ( LOG_WARNING , " Pool %d communication resumed, submitting work" , pool - > pool_no ) ;
applog ( LOG_WARNING , " %s communication resumed, submitting work" , pool - > poolname ) ;
mutex_lock ( & sshare_lock ) ;
HASH_ADD_INT ( stratum_shares , id , sshare ) ;
@ -5310,7 +5321,7 @@ static void *stratum_sthread(void *userdata)
@@ -5310,7 +5321,7 @@ static void *stratum_sthread(void *userdata)
break ;
}
if ( ! pool_tset ( pool , & pool - > submit_fail ) & & cnx_needed ( pool ) ) {
applog ( LOG_WARNING , " Pool %d stratum share submission failure" , pool - > pool_no ) ;
applog ( LOG_WARNING , " %s stratum share submission failure" , pool - > poolname ) ;
total_ro + + ;
pool - > remotefail_occasions + + ;
}
@ -5362,7 +5373,7 @@ static void *longpoll_thread(void *userdata);
@@ -5362,7 +5373,7 @@ static void *longpoll_thread(void *userdata);
static bool stratum_works ( struct pool * pool )
{
applog ( LOG_INFO , " Testing pool %d stratum %s " , pool - > pool_no , pool - > stratum_url ) ;
applog ( LOG_INFO , " Testing %s stratum %s " , pool - > poolname , pool - > stratum_url ) ;
if ( ! extract_sockaddr ( pool - > stratum_url , & pool - > sockaddr_url , & pool - > stratum_port ) )
return false ;
@ -5381,9 +5392,9 @@ static bool pool_active(struct pool *pool, bool pinging)
@@ -5381,9 +5392,9 @@ static bool pool_active(struct pool *pool, bool pinging)
int uninitialised_var ( rolltime ) ;
if ( pool - > has_gbt )
applog ( LOG_DEBUG , " Retrieving block template from pool %s " , pool - > rpc_url ) ;
applog ( LOG_DEBUG , " Retrieving block template from %s " , pool - > poolname ) ;
else
applog ( LOG_INFO , " Testing pool %s " , pool - > rpc_url ) ;
applog ( LOG_INFO , " Testing %s " , pool - > poolname ) ;
/* This is the central point we activate stratum when we can */
retry_stratum :
@ -5467,7 +5478,7 @@ retry_stratum:
@@ -5467,7 +5478,7 @@ retry_stratum:
/* Detect if a http getwork pool has an X-Stratum header at startup,
* and if so , switch to that in preference to getwork if it works */
if ( pool - > stratum_url & & ! opt_fix_protocol & & stratum_works ( pool ) ) {
applog ( LOG_NOTICE , " Switching pool %d %s to %s " , pool - > pool_no , pool - > rpc_url , pool - > stratum_url ) ;
applog ( LOG_NOTICE , " Switching %s %s to %s " , pool - > poolname , pool - > rpc_url , pool - > stratum_url ) ;
if ( ! pool - > rpc_url )
pool - > rpc_url = strdup ( pool - > stratum_url ) ;
pool - > has_stratum = true ;
@ -5482,8 +5493,7 @@ retry_stratum:
@@ -5482,8 +5493,7 @@ retry_stratum:
rc = work_decode ( pool , work , val ) ;
if ( rc ) {
applog ( LOG_DEBUG , " Successfully retrieved and deciphered work from pool %u %s " ,
pool - > pool_no , pool - > rpc_url ) ;
applog ( LOG_DEBUG , " Successfully retrieved and deciphered work from %s " , pool - > poolname ) ;
work - > pool = pool ;
work - > rolltime = rolltime ;
copy_time ( & work - > tv_getwork , & tv_getwork ) ;
@ -5498,8 +5508,7 @@ retry_stratum:
@@ -5498,8 +5508,7 @@ retry_stratum:
ret = true ;
cgtime ( & pool - > tv_idle ) ;
} else {
applog ( LOG_DEBUG , " Successfully retrieved but FAILED to decipher work from pool %u %s " ,
pool - > pool_no , pool - > rpc_url ) ;
applog ( LOG_DEBUG , " Successfully retrieved but FAILED to decipher work from %s " , pool - > poolname ) ;
free_work ( work ) ;
}
json_decref ( val ) ;
@ -5547,10 +5556,9 @@ retry_stratum:
@@ -5547,10 +5556,9 @@ retry_stratum:
pool - > has_stratum = true ;
goto retry_stratum ;
}
applog ( LOG_DEBUG , " FAILED to retrieve work from pool %u %s " ,
pool - > pool_no , pool - > rpc_url ) ;
applog ( LOG_DEBUG , " FAILED to retrieve work from %s " , pool - > poolname ) ;
if ( ! pinging )
applog ( LOG_WARNING , " Pool %u slow/down or URL or credentials invalid" , pool - > pool_no ) ;
applog ( LOG_WARNING , " %s slow/down or URL or credentials invalid" , pool - > poolname ) ;
}
out :
curl_easy_cleanup ( curl ) ;
@ -5560,9 +5568,9 @@ out:
@@ -5560,9 +5568,9 @@ out:
static void pool_resus ( struct pool * pool )
{
if ( pool_strategy = = POOL_FAILOVER & & pool - > prio < cp_prio ( ) )
applog ( LOG_WARNING , " Pool %d %s alive, testing stability" , pool - > pool_no , pool - > rpc_url ) ;
applog ( LOG_WARNING , " %s alive, testing stability " , pool - > poolname ) ;
else
applog ( LOG_INFO , " Pool %d %s alive" , pool - > pool_no , pool - > rpc_url ) ;
applog ( LOG_INFO , " %s alive " , pool - > poolname ) ;
}
static struct work * hash_pop ( void )
@ -5791,11 +5799,11 @@ static void submit_work_async(struct work *work)
@@ -5791,11 +5799,11 @@ static void submit_work_async(struct work *work)
if ( stale_work ( work , true ) ) {
if ( opt_submit_stale )
applog ( LOG_NOTICE , " Pool %d stale share detected, submitting as user requested" , pool - > pool_no ) ;
applog ( LOG_NOTICE , " %s stale share detected, submitting as user requested" , pool - > poolname ) ;
else if ( pool - > submit_old )
applog ( LOG_NOTICE , " Pool %d stale share detected, submitting as pool requested" , pool - > pool_no ) ;
applog ( LOG_NOTICE , " %s stale share detected, submitting as pool requested" , pool - > poolname ) ;
else {
applog ( LOG_NOTICE , " Pool %d stale share detected, discarding" , pool - > pool_no ) ;
applog ( LOG_NOTICE , " %s stale share detected, discarding" , pool - > poolname ) ;
sharelog ( " discard " , work ) ;
mutex_lock ( & stats_lock ) ;
@ -5812,7 +5820,7 @@ static void submit_work_async(struct work *work)
@@ -5812,7 +5820,7 @@ static void submit_work_async(struct work *work)
}
if ( work - > stratum ) {
applog ( LOG_DEBUG , " Pushing pool %d work to stratum queue " , pool - > pool_no ) ;
applog ( LOG_DEBUG , " Pushing %s work to stratum queue " , pool - > poolname ) ;
if ( unlikely ( ! tq_push ( pool - > stratum_q , work ) ) ) {
applog ( LOG_DEBUG , " Discarding work from removed pool " ) ;
free_work ( work ) ;
@ -5885,7 +5893,7 @@ static void update_work_stats(struct thr_info *thr, struct work *work)
@@ -5885,7 +5893,7 @@ static void update_work_stats(struct thr_info *thr, struct work *work)
work - > pool - > solved + + ;
found_blocks + + ;
work - > mandatory = true ;
applog ( LOG_NOTICE , " Found block for pool %d ! " , work - > pool - > pool_no ) ;
applog ( LOG_NOTICE , " Found block for %s ! " , work - > pool - > poolname ) ;
}
mutex_lock ( & stats_lock ) ;
@ -6709,7 +6717,7 @@ static void reap_curl(struct pool *pool)
@@ -6709,7 +6717,7 @@ static void reap_curl(struct pool *pool)
mutex_unlock ( & pool - > pool_lock ) ;
if ( reaped )
applog ( LOG_DEBUG , " Reaped %d curl%s from pool %d " , reaped , reaped > 1 ? " s " : " " , pool - > pool_no ) ;
applog ( LOG_DEBUG , " Reaped %d curl%s from %s " , reaped , reaped > 1 ? " s " : " " , pool - > poolname ) ;
}
static void * watchpool_thread ( void __maybe_unused * userdata )
@ -6767,8 +6775,7 @@ static void *watchpool_thread(void __maybe_unused *userdata)
@@ -6767,8 +6775,7 @@ static void *watchpool_thread(void __maybe_unused *userdata)
* intermittently failing pools from being used . */
if ( ! pool - > idle & & pool_strategy = = POOL_FAILOVER & & pool - > prio < cp_prio ( ) & &
now . tv_sec - pool - > tv_idle . tv_sec > 60 ) {
applog ( LOG_WARNING , " Pool %d %s stable for 1 minute " ,
pool - > pool_no , pool - > rpc_url ) ;
applog ( LOG_WARNING , " %s %s stable for 1 minute " , pool - > poolname , pool - > rpc_url ) ;
switch_pools ( NULL ) ;
}
}
@ -7130,7 +7137,7 @@ static void *test_pool_thread(void *arg)
@@ -7130,7 +7137,7 @@ static void *test_pool_thread(void *arg)
cg_wunlock ( & control_lock ) ;
if ( unlikely ( first_pool ) )
applog ( LOG_NOTICE , " Switching to pool %d %s - first alive pool " , pool - > pool_no , pool - > rpc_url ) ;
applog ( LOG_NOTICE , " Switching to %s - first alive pool " , pool - > poolname ) ;
pool_resus ( pool ) ;
switch_pools ( NULL ) ;
@ -7766,7 +7773,7 @@ int main(int argc, char *argv[])
@@ -7766,7 +7773,7 @@ int main(int argc, char *argv[])
if ( ! pool - > rpc_userpass ) {
if ( ! pool - > rpc_user | | ! pool - > rpc_pass )
quit ( 1 , " No login credentials supplied for pool %u %s " , i , pool - > rpc_url ) ;
quit ( 1 , " No login credentials supplied for %s " , pool - > poolname ) ;
siz = strlen ( pool - > rpc_user ) + strlen ( pool - > rpc_pass ) + 2 ;
pool - > rpc_userpass = malloc ( siz ) ;
if ( ! pool - > rpc_userpass )
@ -7964,7 +7971,7 @@ begin_bench:
@@ -7964,7 +7971,7 @@ begin_bench:
work = make_work ( ) ;
if ( lagging & & ! pool_tset ( cp , & cp - > lagging ) ) {
applog ( LOG_WARNING , " Pool %d not providing work fast enough" , cp - > pool_no ) ;
applog ( LOG_WARNING , " %s not providing work fast enough" , cp - > poolname ) ;
cp - > getfail_occasions + + ;
total_go + + ;
}
@ -8022,7 +8029,7 @@ retry:
@@ -8022,7 +8029,7 @@ retry:
ce = pop_curl_entry ( pool ) ;
/* obtain new work from bitcoin via JSON-RPC */
if ( ! get_upstream_work ( work , ce - > curl ) ) {
applog ( LOG_DEBUG , " Pool %d json_rpc_call failed on get work, retrying in 5s" , pool - > pool_no ) ;
applog ( LOG_DEBUG , " %s json_rpc_call failed on get work, retrying in 5s" , pool - > poolname ) ;
/* Make sure the pool just hasn't stopped serving
* requests but is up as we ' ll keep hammering it */
if ( + + pool - > seq_getfails > mining_threads + opt_queue )