Make the cointerra displayed hashrate based on valid share generation.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
diff --git a/driver-cointerra.c b/driver-cointerra.c
index d17c0aa..2e3911a 100644
--- a/driver-cointerra.c
+++ b/driver-cointerra.c
@@ -369,7 +369,7 @@ static void cta_parse_recvmatch(struct thr_info *thr, struct cgpu_info *cointerr
mutex_lock(&info->lock);
if (ret)
- info->share_hashes += (uint64_t)work->work_difficulty * 0x100000000ull;
+ info->share_hashes = (uint64_t)work->work_difficulty * 0x100000000ull;
info->hashes += nonce;
mutex_unlock(&info->lock);
} else {
@@ -951,9 +951,10 @@ static int64_t cta_scanwork(struct thr_info *thr)
}
mutex_lock(&info->lock);
- hashes = info->hashes;
- info->tot_calc_hashes += hashes;
- info->hashes = 0;
+ hashes = info->share_hashes;
+ info->tot_share_hashes += info->share_hashes;
+ info->tot_calc_hashes += info->hashes;
+ info->hashes = info->share_hashes = 0;
mutex_unlock(&info->lock);
if (unlikely(cointerra->usbinfo.nodev))
@@ -987,7 +988,7 @@ static void cta_zero_stats(struct cgpu_info *cointerra)
info->tot_calc_hashes = 0;
info->tot_reset_hashes = info->tot_hashes;
- info->share_hashes = 0;
+ info->tot_share_hashes = 0;
}
static struct api_data *cta_api_stats(struct cgpu_info *cgpu)
@@ -1072,13 +1073,13 @@ static struct api_data *cta_api_stats(struct cgpu_info *cgpu)
root = api_add_uint64(root, "Hashrate", &ghs, true);
ghs = info->tot_hashes / dev_runtime;
root = api_add_uint64(root, "Raw hashrate", &ghs, true);
- ghs = info->share_hashes / dev_runtime;
+ ghs = info->tot_share_hashes / dev_runtime;
root = api_add_uint64(root, "Share hashrate", &ghs, true);
root = api_add_uint64(root, "Total calc hashes", &info->tot_calc_hashes, false);
ghs = info->tot_hashes - info->tot_reset_hashes;
root = api_add_uint64(root, "Total hashes", &ghs, true);
root = api_add_uint64(root, "Total raw hashes", &info->tot_hashes, false);
- root = api_add_uint64(root, "Total share hashes", &info->share_hashes, false);
+ root = api_add_uint64(root, "Total share hashes", &info->tot_share_hashes, false);
root = api_add_uint64(root, "Total flushed hashes", &info->tot_flushed_hashes, false);
val = cgpu->diff_accepted * 0x100000000ull;
root = api_add_uint64(root, "Accepted hashes", &val, true);
diff --git a/driver-cointerra.h b/driver-cointerra.h
index 523012e..d8344e8 100644
--- a/driver-cointerra.h
+++ b/driver-cointerra.h
@@ -201,6 +201,7 @@ struct cointerra_info {
/* Calculated totals based on shares returned */
uint64_t share_hashes;
+ uint64_t tot_share_hashes;
int requested;
uint16_t work_id;
int no_matching_work;