From 0f7daecac4b812f3b5dfb829bce1146f231b60b0 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Fri, 3 Oct 2014 08:38:22 +1000 Subject: [PATCH] Stats on 1st reject were being missed --- src/stratifier.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/stratifier.c b/src/stratifier.c index 264352f9..c4019032 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -1748,6 +1748,14 @@ static void add_submit(ckpool_t *ckp, stratum_instance_t *client, int diff, bool int64_t next_blockid, optimal; tv_t now_t; + mutex_lock(&stats_lock); + if (valid) { + stats.unaccounted_shares++; + stats.unaccounted_diff_shares += diff; + } else + stats.unaccounted_rejects += diff; + mutex_unlock(&stats_lock); + /* Ignore successive rejects in count if they haven't submitted a valid * share yet. */ if (unlikely(!client->ssdc && !valid)) @@ -1795,14 +1803,6 @@ static void add_submit(ckpool_t *ckp, stratum_instance_t *client, int diff, bool bias = time_bias(bdiff, 300); tdiff = sane_tdiff(&now_t, &client->ldc); - mutex_lock(&stats_lock); - if (valid) { - stats.unaccounted_shares++; - stats.unaccounted_diff_shares += diff; - } else - stats.unaccounted_rejects += diff; - mutex_unlock(&stats_lock); - /* Check the difficulty every 240 seconds or as many shares as we * should have had in that time, whichever comes first. */ if (client->ssdc < 72 && tdiff < 240)