|
|
@@ -6552,7 +6552,7 @@ static struct pool *select_longpoll_pool(struct pool *cp)
|
|
|
for (i = 0; i < total_pools; i++) {
|
|
|
struct pool *pool = pools[i];
|
|
|
|
|
|
- if (pool->lp_url)
|
|
|
+ if (pool->has_stratum || pool->lp_url)
|
|
|
return pool;
|
|
|
}
|
|
|
return NULL;
|
|
|
@@ -6597,19 +6597,25 @@ static void *longpoll_thread(void *userdata)
|
|
|
curl = curl_easy_init();
|
|
|
if (unlikely(!curl)) {
|
|
|
applog(LOG_ERR, "CURL initialisation failed");
|
|
|
- goto out;
|
|
|
+ return NULL;
|
|
|
}
|
|
|
|
|
|
retry_pool:
|
|
|
pool = select_longpoll_pool(cp);
|
|
|
if (!pool) {
|
|
|
- applog(LOG_WARNING, "No suitable long-poll found for pool %s", cp->rpc_url);
|
|
|
+ applog(LOG_WARNING, "No suitable long-poll found for %s", cp->rpc_url);
|
|
|
while (!pool) {
|
|
|
sleep(60);
|
|
|
pool = select_longpoll_pool(cp);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if (pool->has_stratum) {
|
|
|
+ applog(LOG_WARNING, "Block change for %s detection via %s stratum",
|
|
|
+ cp->rpc_url, pool->rpc_url);
|
|
|
+ goto out;
|
|
|
+ }
|
|
|
+
|
|
|
/* Any longpoll from any pool is enough for this to be true */
|
|
|
have_longpoll = true;
|
|
|
|
|
|
@@ -6620,7 +6626,7 @@ retry_pool:
|
|
|
if (cp == pool)
|
|
|
applog(LOG_WARNING, "Long-polling activated for %s (%s)", lp_url, pool_protocol_name(pool->lp_proto));
|
|
|
else
|
|
|
- applog(LOG_WARNING, "Long-polling activated for pool %s via %s (%s)", cp->rpc_url, lp_url, pool_protocol_name(pool->lp_proto));
|
|
|
+ applog(LOG_WARNING, "Long-polling activated for %s via %s (%s)", cp->rpc_url, lp_url, pool_protocol_name(pool->lp_proto));
|
|
|
}
|
|
|
|
|
|
while (42) {
|
|
|
@@ -6675,8 +6681,14 @@ retry_pool:
|
|
|
lpfail:
|
|
|
sleep(30);
|
|
|
}
|
|
|
+
|
|
|
if (pool != cp) {
|
|
|
pool = select_longpoll_pool(cp);
|
|
|
+ if (pool->has_stratum) {
|
|
|
+ applog(LOG_WARNING, "Block change for %s detection via %s stratum",
|
|
|
+ cp->rpc_url, pool->rpc_url);
|
|
|
+ break;
|
|
|
+ }
|
|
|
if (unlikely(!pool))
|
|
|
goto retry_pool;
|
|
|
}
|
|
|
@@ -6686,8 +6698,7 @@ lpfail:
|
|
|
}
|
|
|
|
|
|
out:
|
|
|
- if (curl)
|
|
|
- curl_easy_cleanup(curl);
|
|
|
+ curl_easy_cleanup(curl);
|
|
|
|
|
|
return NULL;
|
|
|
}
|