diff --git a/src/ckpool.c b/src/ckpool.c index 8bda9dd0..11c12f7d 100644 --- a/src/ckpool.c +++ b/src/ckpool.c @@ -1481,7 +1481,6 @@ static struct option long_options[] = { {"killold", no_argument, 0, 'k'}, {"log-shares", no_argument, 0, 'L'}, {"loglevel", required_argument, 0, 'l'}, - {"node", no_argument, 0, 'N'}, {"name", required_argument, 0, 'n'}, {"passthrough", no_argument, 0, 'P'}, {"proxy", no_argument, 0, 'p'}, @@ -1500,7 +1499,6 @@ static struct option long_options[] = { {"killold", no_argument, 0, 'k'}, {"log-shares", no_argument, 0, 'L'}, {"loglevel", required_argument, 0, 'l'}, - {"node", no_argument, 0, 'N'}, {"name", required_argument, 0, 'n'}, {"passthrough", no_argument, 0, 'P'}, {"proxy", no_argument, 0, 'p'}, @@ -1548,7 +1546,7 @@ int main(int argc, char **argv) ckp.initial_args[ckp.args] = strdup(argv[ckp.args]); ckp.initial_args[ckp.args] = NULL; - while ((c = getopt_long(argc, argv, "Ac:Dd:g:HhkLl:Nn:PpRS:s:", long_options, &i)) != -1) { + while ((c = getopt_long(argc, argv, "Ac:Dd:g:HhkLl:n:PpRS:s:", long_options, &i)) != -1) { switch (c) { case 'A': ckp.standalone = true; @@ -1599,27 +1597,22 @@ int main(int argc, char **argv) LOG_EMERG, LOG_DEBUG, ckp.loglevel); } break; - case 'N': - if (ckp.proxy || ckp.redirector || ckp.passthrough) - quit(1, "Cannot set combinations of proxy, node, redirector and passthrough"); - ckp.standalone = ckp.node = ckp.proxy = ckp.passthrough = true; - break; case 'n': ckp.name = optarg; break; case 'P': - if (ckp.node || ckp.proxy || ckp.redirector) - quit(1, "Cannot set combinations of proxy, node, redirector and passthrough"); + if (ckp.proxy || ckp.redirector) + quit(1, "Cannot set both proxy or redirector and passthrough mode"); ckp.standalone = ckp.proxy = ckp.passthrough = true; break; case 'p': - if (ckp.node || ckp.passthrough || ckp.redirector) - quit(1, "Cannot set combinations of proxy, node, redirector and passthrough"); + if (ckp.passthrough || ckp.redirector) + quit(1, "Cannot set both passthrough or redirector and proxy mode"); ckp.proxy = true; break; case 'R': - if (ckp.node || ckp.proxy || ckp.passthrough) - quit(1, "Cannot set combinations of proxy, node, redirector and passthrough"); + if (ckp.proxy || ckp.passthrough) + quit(1, "Cannot set both proxy or passthrough and redirector modes"); ckp.standalone = ckp.proxy = ckp.passthrough = ckp.redirector = true; break; case 'S': @@ -1632,9 +1625,7 @@ int main(int argc, char **argv) } if (!ckp.name) { - if (ckp.node) - ckp.name = "cknode"; - else if (ckp.redirector) + if (ckp.redirector) ckp.name = "ckredirector"; else if (ckp.passthrough) ckp.name = "ckpassthrough"; diff --git a/src/ckpool.h b/src/ckpool.h index 0fcd4b5b..39d24c01 100644 --- a/src/ckpool.h +++ b/src/ckpool.h @@ -22,7 +22,6 @@ #define RPC_TIMEOUT 60 struct ckpool_instance; - typedef struct ckpool_instance ckpool_t; struct ckmsg { @@ -184,9 +183,6 @@ struct ckpool_instance { /* Are we a redirecting passthrough */ bool redirector; - /* Are we a relay node passthrough */ - bool node; - /* Are we running as a proxy */ bool proxy; @@ -228,7 +224,6 @@ struct ckpool_instance { char **proxyurl; char **proxyauth; char **proxypass; - server_instance_t *btcdbackup; /* Passthrough redirect options */ int redirecturls; diff --git a/src/connector.c b/src/connector.c index 1c8ff948..46142cc4 100644 --- a/src/connector.c +++ b/src/connector.c @@ -61,8 +61,6 @@ struct client_instance { /* Is this the parent passthrough client */ bool passthrough; - /* Is this a parent relay passthrough node client */ - bool node; /* Linked list of shares in redirector mode.*/ share_t *shares; @@ -899,14 +897,13 @@ static bool client_exists(cdata_t *cdata, const int64_t id) return !!client; } -static void passthrough_client(cdata_t *cdata, client_instance_t *client, const bool node) +static void passthrough_client(cdata_t *cdata, client_instance_t *client) { char *buf; - LOGINFO("Connector adding passthrough %sclient %"PRId64, node ? "node " : "", client->id); + LOGINFO("Connector adding passthrough client %"PRId64, client->id); client->passthrough = true; - client->node = node; - ASPRINTF(&buf, "{\"result\": true, \"node\": %s}\n", node ? "true" : "false"); + ASPRINTF(&buf, "{\"result\": true}\n"); send_client(cdata, client->id, buf); } @@ -1093,22 +1090,7 @@ retry: LOGINFO("Connector failed to find client id %"PRId64" to pass through", client_id); goto retry; } - passthrough_client(cdata, client, false); - dec_instance_ref(cdata, client); - } else if (cmdmatch(buf, "node")) { - client_instance_t *client; - - ret = sscanf(buf, "node=%"PRId64, &client_id); - if (ret < 0) { - LOGDEBUG("Connector failed to parse node command: %s", buf); - goto retry; - } - client = ref_client_by_id(cdata, client_id); - if (unlikely(!client)) { - LOGINFO("Connector failed to find client id %"PRId64" to node pass through", client_id); - goto retry; - } - passthrough_client(cdata, client, true); + passthrough_client(cdata, client); dec_instance_ref(cdata, client); } else if (cmdmatch(buf, "getxfd")) { int fdno = -1; diff --git a/src/generator.c b/src/generator.c index aaff49e1..dd135b80 100644 --- a/src/generator.c +++ b/src/generator.c @@ -755,15 +755,15 @@ out: return ret; } -static bool passthrough_stratum(connsock_t *cs, proxy_instance_t *proxi, const bool node) +static bool passthrough_stratum(connsock_t *cs, proxy_instance_t *proxi) { json_t *req, *val = NULL, *res_val, *err_val; float timeout = 10; bool ret = false; - JSON_CPACK(req, "{s:s,s:[sb]}", + JSON_CPACK(req, "{s:s,s:[s]}", "method", "mining.passthrough", - "params", PACKAGE"/"VERSION, node); + "params", PACKAGE"/"VERSION); ret = send_json_msg(cs, req); json_decref(req); if (!ret) { @@ -1761,7 +1761,7 @@ static bool proxy_alive(ckpool_t *ckp, proxy_instance_t *proxi, connsock_t *cs, goto out; } if (ckp->passthrough) { - if (!passthrough_stratum(cs, proxi, ckp->node)) { + if (!passthrough_stratum(cs, proxi)) { LOGWARNING("Failed initial passthrough to %s:%s !", cs->url, cs->port); goto out; @@ -2029,7 +2029,7 @@ static void *proxy_recv(void *arg) * has likely stopped responding. */ ret = epoll_wait(epfd, &event, 1, 600000); if (likely(ret > 0)) { - float timeout = 10; + float timeout = 30; subproxy = event.data.ptr; cs = &subproxy->cs; @@ -2707,31 +2707,6 @@ static int proxy_mode(ckpool_t *ckp, proc_instance_t *pi) } } - if (ckp->node) { - if (ckp->btcds) { - /* If we also have btcds set up in node mode, try to talk to - * one of them as a way to submit blocks if we find them when - * submitting them upstream. */ - server_instance_t *si = ckp->btcdbackup = ckzalloc(sizeof(server_instance_t)); - - si->url = ckp->btcdurl[0]; - si->auth = ckp->btcdauth[0]; - si->pass = ckp->btcdpass[0]; - if (server_alive(ckp, si, false)) { - LOGNOTICE("Node backup btcd %s:%s alive", si->cs.url, si->cs.port); - } else { - LOGWARNING("Node backup btcd %s:%s failed! Will run as ordinary passthrough", - si->cs.url, si->cs.port); - ckp->btcdbackup = NULL; - free(si); - ckp->node = false; - } - } else { - LOGWARNING("No backup btcd specified in node mode! Will run as ordinary passthrough"); - ckp->node = false; - } - } - LOGWARNING("%s generator ready", ckp->name); ret = proxy_loop(pi); diff --git a/src/stratifier.c b/src/stratifier.c index 8c6bddab..55cbc3dc 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -4817,21 +4817,14 @@ static void parse_method(ckpool_t *ckp, sdata_t *sdata, stratum_instance_t *clie } if (unlikely(cmdmatch(method, "mining.passthrough"))) { - json_t *nodeval = json_array_get(params_val, 1); char buf[256]; - bool node; - if (nodeval) - node = json_is_true(nodeval); - else - node = false; /* We need to inform the connector process that this client * is a passthrough and to manage its messages accordingly. No * data from this client id should ever come back to this * stratifier after this so drop the client in the stratifier. */ - LOGNOTICE("Adding %spassthrough client %"PRId64" %s", node ? "node " : "", - client_id, client->address); - snprintf(buf, 255, "%s=%"PRId64, node ? "node" : "passthrough", client_id); + LOGNOTICE("Adding passthrough client %"PRId64" %s", client_id, client->address); + snprintf(buf, 255, "passthrough=%"PRId64, client_id); send_proc(ckp->connector, buf); drop_client(ckp, sdata, client_id); return;