mirror of
https://github.com/LBRYFoundation/pool.git
synced 2025-08-23 17:37:25 +00:00
stratum: link new limits db fields
the share counter will allow you to auto restart the stratum, if required.
This commit is contained in:
parent
0b4818c36e
commit
f31dd15d4e
4 changed files with 20 additions and 1 deletions
|
@ -158,7 +158,7 @@ void db_update_coinds(YAAMP_DB *db)
|
|||
db_query(db, "SELECT id, name, rpchost, rpcport, rpcuser, rpcpasswd, rpcencoding, master_wallet, reward, price, "
|
||||
"hassubmitblock, txmessage, enable, auto_ready, algo, pool_ttf, charity_address, charity_amount, charity_percent, "
|
||||
"reward_mul, symbol, auxpow, actual_ttf, network_ttf, usememorypool, hasmasternodes, algo, symbol2, "
|
||||
"rpccurl, rpcssl, rpccert, account, multialgos "
|
||||
"rpccurl, rpcssl, rpccert, account, multialgos, max_miners, max_shares "
|
||||
"FROM coins WHERE enable AND auto_ready AND algo='%s' ORDER BY index_avg", g_stratum_algo);
|
||||
|
||||
MYSQL_RES *result = mysql_store_result(&db->mysql);
|
||||
|
@ -256,6 +256,8 @@ void db_update_coinds(YAAMP_DB *db)
|
|||
|
||||
if(row[31]) strcpy(coind->account, row[31]);
|
||||
if(row[32]) coind->multialgos = atoi(row[32]);
|
||||
if(row[33] && atoi(row[33]) > 0) g_stratum_max_cons = atoi(row[33]);
|
||||
if(row[34] && atol(row[34]) > 0) g_max_shares = atol(row[34]);
|
||||
|
||||
// force the right rpcencoding for DCR
|
||||
if(!strcmp(coind->symbol, "DCR") && strcmp(coind->rpcencoding, "DCR"))
|
||||
|
|
|
@ -78,6 +78,7 @@ static void share_add_worker(YAAMP_CLIENT *client, YAAMP_JOB *job, bool valid, c
|
|||
void share_add(YAAMP_CLIENT *client, YAAMP_JOB *job, bool valid, char *extranonce2, char *ntime, char *nonce, double share_diff, int error_number)
|
||||
{
|
||||
// check_job(job);
|
||||
g_shares_counter++;
|
||||
share_add_worker(client, job, valid, ntime, share_diff, error_number);
|
||||
|
||||
YAAMP_SHARE *share = new YAAMP_SHARE;
|
||||
|
|
|
@ -33,6 +33,9 @@ bool g_stratum_reconnect;
|
|||
bool g_stratum_renting;
|
||||
bool g_autoexchange = true;
|
||||
|
||||
uint64_t g_max_shares = 0;
|
||||
uint64_t g_shares_counter = 0;
|
||||
|
||||
time_t g_last_broadcasted = 0;
|
||||
YAAMP_DB *g_db = NULL;
|
||||
|
||||
|
@ -308,6 +311,16 @@ void *monitor_thread(void *p)
|
|||
stratumlog("%s dead lock, exiting...\n", g_current_algo->name);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if(g_max_shares > 0 && g_shares_counter > g_max_shares) {
|
||||
g_exiting = true;
|
||||
stratumlog("%s need a restart, exiting...\n", g_current_algo->name);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if((g_shares_counter % 10000u) == 0) {
|
||||
stratumlog("%s %luK shares...\n", g_current_algo->name, (unsigned long) (g_max_shares/10000u));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -83,6 +83,9 @@ extern int g_stratum_max_ttf;
|
|||
extern bool g_stratum_reconnect;
|
||||
extern bool g_stratum_renting;
|
||||
|
||||
extern uint64_t g_max_shares;
|
||||
extern uint64_t g_shares_counter;
|
||||
|
||||
extern time_t g_last_broadcasted;
|
||||
|
||||
extern struct ifaddrs *g_ifaddr;
|
||||
|
|
Loading…
Add table
Reference in a new issue