API - add Stratum information to pools
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
diff --git a/API-README b/API-README
index 7e5fac8..c97dee0 100644
--- a/API-README
+++ b/API-README
@@ -383,6 +383,13 @@ miner.php - an example web page to access the API
Feature Changelog for external applications using the API:
+API V1.20
+
+Modified API commands:
+ 'pools' - add 'Has Stratum', 'Stratum Active', 'Stratum URL'
+
+----------
+
API V1.19 (cgminer v2.7.6)
Added API commands:
diff --git a/api.c b/api.c
index 8c358af..ff84e3c 100644
--- a/api.c
+++ b/api.c
@@ -131,7 +131,7 @@ static const char SEPARATOR = '|';
#define SEPSTR "|"
static const char GPUSEP = ',';
-static const char *APIVERSION = "1.19";
+static const char *APIVERSION = "1.20";
static const char *DEAD = "Dead";
#if defined(HAVE_OPENCL) || defined(HAVE_AN_FPGA)
static const char *SICK = "Sick";
@@ -1810,6 +1810,9 @@ static void poolstatus(__maybe_unused SOCKETTYPE c, __maybe_unused char *param,
for (i = 0; i < total_pools; i++) {
struct pool *pool = pools[i];
+ if (pool->removed)
+ continue;
+
switch (pool->enabled) {
case POOL_DISABLED:
status = (char *)DISABLED;
@@ -1859,6 +1862,12 @@ static void poolstatus(__maybe_unused SOCKETTYPE c, __maybe_unused char *param,
root = api_add_diff(root, "Difficulty Rejected", &(pool->diff_rejected), false);
root = api_add_diff(root, "Difficulty Stale", &(pool->diff_stale), false);
root = api_add_diff(root, "Last Share Difficulty", &(pool->last_share_diff), false);
+ root = api_add_bool(root, "Has Stratum", &(pool->has_stratum), false);
+ root = api_add_bool(root, "Stratum Active", &(pool->stratum_active), false);
+ if (pool->stratum_active)
+ root = api_add_escape(root, "Stratum URL", pool->stratum_url, false);
+ else
+ root = api_add_const(root, "Stratum URL", BLANK, false);
if (isjson && (i > 0))
strcat(io_buffer, COMMA);