Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions stratum/stratum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -386,30 +386,30 @@ int main(int argc, char **argv)

void *monitor_thread(void *p)
{
int cacheHeight = 0;

while(!g_exiting)
{
sleep(0.2);
sleep(120);

g_list_coind.Enter();
for(CLI li = g_list_coind.first; li; li = li->next)
if(g_last_broadcasted + YAAMP_MAXJOBDELAY < time(NULL))
{
YAAMP_COIND *coind = (YAAMP_COIND *)li->data;
json_value *json = rpc_call(&coind->rpc, "getblockcount");
if (!json) continue;
json_int_t amount = json_get_int(json, "result");

if (coind->height != amount) {
if (coind->height != cacheHeight) {
debuglog("coind->height differs from rpc response, forcing new template (%d vs %d)..\n", coind->height, amount);
cacheHeight = coind->height;
}
coind_create_job(coind, true);
job_update();
g_exiting = true;
stratumlogdate("%s dead lock, exiting...\n", g_stratum_algo);
exit(1);
}

if(g_max_shares && g_shares_counter) {

if((g_shares_counter - g_shares_log) > 10000) {
stratumlogdate("%s %luK shares...\n", g_stratum_algo, (g_shares_counter/1000u));
g_shares_log = g_shares_counter;
}

if(g_shares_counter > g_max_shares) {
g_exiting = true;
stratumlogdate("%s need a restart (%lu shares), exiting...\n", g_stratum_algo, (unsigned long) g_max_shares);
exit(1);
}
}
g_list_coind.Leave();
}
}

Expand Down