From fb5134c74d27b67e4146617d1c1f90b0a50ac044 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Thu, 7 Jan 2016 12:10:46 +1100 Subject: [PATCH] Allow unsubscribed miners to authorise out of order --- src/stratifier.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/stratifier.c b/src/stratifier.c index e430fe6b..4cdb238c 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -5266,14 +5266,8 @@ static void parse_method(ckpool_t *ckp, sdata_t *sdata, stratum_instance_t *clie return; } - /* We should only accept subscribed requests from here on */ - if (!client->subscribed) { - LOGINFO("Dropping unsubscribed client %"PRId64" %s requesting method %s", - client_id, client->address, method); - connector_drop_client(ckp, client_id); - return; - } - + /* We shouldn't really allow unsubscribed users to authorise first but + * some broken stratum implementations do that and we can handle it. */ if (cmdmatch(method, "mining.auth")) { json_params_t *jp; @@ -5287,6 +5281,15 @@ static void parse_method(ckpool_t *ckp, sdata_t *sdata, stratum_instance_t *clie return; } + /* We should only accept requests from subscribed and authed users here + * on */ + if (!client->subscribed) { + LOGINFO("Dropping %s from unsubscribed client %"PRId64" %s", method, + client_id, client->address); + connector_drop_client(ckp, client_id); + return; + } + /* We should only accept authorised requests from here on */ if (!client->authorised) { LOGINFO("Dropping %s from unauthorised client %"PRId64" %s", method,