Browse Source

Remember best share per pool and return in API pools

Kano 13 years ago
parent
commit
03f626e68d
4 changed files with 12 additions and 1 deletions
  1. 8 1
      API-README
  2. 1 0
      api.c
  3. 2 0
      cgminer.c
  4. 1 0
      miner.h

+ 8 - 1
API-README

@@ -400,7 +400,14 @@ miner.php - an example web page to access the API
 Feature Changelog for external applications using the API:
 
 
-API V1.23
+API V1.24
+
+Modified API commands:
+ 'pools' - add 'Best Share'
+
+----------
+
+API V1.23 (cgminer v2.10.2)
 
 Added API commands:
  'pgaset' - with: MMQ opt=clock val=160 to 230 (and a multiple of 2)

+ 1 - 0
api.c

@@ -1993,6 +1993,7 @@ static void poolstatus(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __m
 		else
 			root = api_add_const(root, "Stratum URL", BLANK, false);
 		root = api_add_bool(root, "Has GBT", &(pool->has_gbt), false);
+		root = api_add_uint64(root, "Best Share", &(pool->best_diff), true);
 
 		root = print_data(root, buf, isjson, isjson && (i > 0));
 		io_add(io_data, buf);

+ 2 - 0
cgminer.c

@@ -2349,6 +2349,8 @@ static uint64_t share_diff(const struct work *work)
 		best_diff = ret;
 		suffix_string(best_diff, best_share, 0);
 	}
+	if (ret > work->pool->best_diff)
+		work->pool->best_diff = ret;
 	mutex_unlock(&control_lock);
 	return ret;
 }

+ 1 - 0
miner.h

@@ -920,6 +920,7 @@ struct pool {
 
 	time_t last_share_time;
 	double last_share_diff;
+	uint64_t best_diff;
 
 	struct cgminer_stats cgminer_stats;
 	struct cgminer_pool_stats cgminer_pool_stats;