From 1e68c2d602eead2076b6a103eac35859c83702a2 Mon Sep 17 00:00:00 2001 From: kanoi Date: Sat, 14 Mar 2015 14:10:54 +1100 Subject: [PATCH] ckdb/php - pass statsconfirmed to php to flag estimate stats --- pool/page_blocks.php | 14 ++++++++++---- src/ckdb.h | 2 +- src/ckdb_cmd.c | 11 ++++++++--- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/pool/page_blocks.php b/pool/page_blocks.php index 1556323c..ba07472f 100644 --- a/pool/page_blocks.php +++ b/pool/page_blocks.php @@ -182,6 +182,12 @@ function doblocks($data, $user) if ($stat == 'Orphan') $stara = '*'; + $statsconf = $ans['statsconf:'.$i]; + if ($statsconf == 'Y') + $approx = ''; + else + $approx = '~'; + $diffacc = $ans['diffacc:'.$i]; $acc = number_format($diffacc, 0); @@ -200,7 +206,7 @@ function doblocks($data, $user) if ($stat != 'Orphan') $nettot += $netdiff; - $cdfdsp = number_format($cdf, 2); + $cdfdsp = number_format($cdf, 3); } else { @@ -218,9 +224,9 @@ function doblocks($data, $user) $pg .= "".htmlspecialchars($ans['workername:'.$i]).''; $pg .= "".btcfmt($ans['reward:'.$i]).''; $pg .= "".utcd($ans['firstcreatedate:'.$i]).''; - $pg .= "".$stat.''; - $pg .= "$stara$acc"; - $pg .= "$bpct"; + $pg .= "$stat"; + $pg .= "$stara$approx$acc"; + $pg .= "$approx$bpct"; $pg .= "$cdfdsp"; $pg .= "\n"; } diff --git a/src/ckdb.h b/src/ckdb.h index 6893ecfa..199d2361 100644 --- a/src/ckdb.h +++ b/src/ckdb.h @@ -55,7 +55,7 @@ #define DB_VLOCK "1" #define DB_VERSION "1.0.0" -#define CKDB_VERSION DB_VERSION"-1.031" +#define CKDB_VERSION DB_VERSION"-1.032" #define WHERE_FFL " - from %s %s() line %d" #define WHERE_FFL_HERE __FILE__, __func__, __LINE__ diff --git a/src/ckdb_cmd.c b/src/ckdb_cmd.c index 93c42a69..6a0e1cc3 100644 --- a/src/ckdb_cmd.c +++ b/src/ckdb_cmd.c @@ -902,6 +902,11 @@ redo: blocks_confirmed(blocks->confirmed), FLDSEP); APPEND_REALLOC(buf, off, len, tmp); + snprintf(tmp, sizeof(tmp), + "statsconf:%d=%s%c", rows, + blocks->statsconfirmed, FLDSEP); + APPEND_REALLOC(buf, off, len, tmp); + double_to_buf(blocks->diffacc, reply, sizeof(reply)); snprintf(tmp, sizeof(tmp), "diffacc:%d=%s%c", rows, reply, FLDSEP); APPEND_REALLOC(buf, off, len, tmp); @@ -1016,8 +1021,8 @@ redo: "rows=%d%cflds=%s%c", rows, FLDSEP, "seq,height,blockhash,nonce,reward,workername,firstcreatedate," - "createdate,status,diffacc,diffinv,shareacc,shareinv,elapsed," - "netdiff,diffratio,cdf,luck", FLDSEP); + "createdate,status,statsconf,diffacc,diffinv,shareacc," + "shareinv,elapsed,netdiff,diffratio,cdf,luck", FLDSEP); APPEND_REALLOC(buf, off, len, tmp); snprintf(tmp, sizeof(tmp), "arn=%s%carp=%s", "Blocks,BlockStats", FLDSEP, ",s"); @@ -5446,7 +5451,7 @@ struct CMDS ckdb_cmds[] = { { CMD_WORKERSTAT,"workerstats", false, true, cmd_workerstats,ACCESS_POOL }, { CMD_BLOCK, "block", false, true, cmd_blocks, ACCESS_POOL }, { CMD_BLOCKLIST,"blocklist", false, false, cmd_blocklist, ACCESS_WEB }, - { CMD_BLOCKSTATUS,"blockstatus",false, false, cmd_blockstatus,ACCESS_WEB }, + { CMD_BLOCKSTATUS,"blockstatus",false, false, cmd_blockstatus,ACCESS_SYSTEM }, { CMD_NEWID, "newid", false, false, cmd_newid, ACCESS_SYSTEM }, { CMD_PAYMENTS, "payments", false, false, cmd_payments, ACCESS_WEB }, { CMD_WORKERS, "workers", false, false, cmd_workers, ACCESS_WEB },