From e92e423412ec94f93d9deabe34727df39d77bab1 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Thu, 19 Mar 2015 16:48:26 +1100 Subject: [PATCH] Send a random sessionid rather than a blank one to prevent miner assuming they've reconnected --- src/stratifier.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/stratifier.c b/src/stratifier.c index c449a3fa..d7ffc9d5 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -2681,10 +2681,14 @@ static json_t *parse_subscribe(stratum_instance_t *client, const int64_t client_ n2len = sdata->workbases->enonce2varlen; ck_runlock(&sdata->workbase_lock); - /* Send a blank sessionid in proxy mode so clients don't think we have + /* Send a random sessionid in proxy mode so clients don't think we have * resumed if enonce1 ends up matching on reconnect. */ if (ckp->proxy) { - JSON_CPACK(ret, "[[[s,s]],s,i]", "mining.notify", "", client->enonce1, + unsigned int now = time(NULL); + char nowx[12]; + + sprintf(nowx, "%x", now); + JSON_CPACK(ret, "[[[s,s]],s,i]", "mining.notify", nowx, client->enonce1, n2len); } else { JSON_CPACK(ret, "[[[s,s]],s,i]", "mining.notify", client->enonce1, client->enonce1,