diff --git a/pool/page_allwork.php b/pool/page_allwork.php
index 15e35a3e..af210dfb 100644
--- a/pool/page_allwork.php
+++ b/pool/page_allwork.php
@@ -13,6 +13,8 @@ function doallwork($data, $user)
$totinvalid = 0;
$totrate = 0;
$offset = 0;
+ $blockacc = 0;
+ $blockreward = 0;
$pg .= worktitle($data, $user);
@@ -24,11 +26,13 @@ function doallwork($data, $user)
{
$pg .= workuser($data, $ans['username:'.$i],
$offset, $totshare, $totdiff,
- $totinvalid, $totrate, 3600);
+ $totinvalid, $totrate,
+ $blockacc, $blockreward, 3600);
}
}
- $pg .= worktotal($offset, $totshare, $totdiff, $totinvalid, $totrate);
+ $pg .= worktotal($offset, $totshare, $totdiff, $totinvalid, $totrate,
+ $blockacc, $blockreward);
$pg .= "\n";
diff --git a/pool/page_workers.php b/pool/page_workers.php
index 7129ab60..fe007999 100644
--- a/pool/page_workers.php
+++ b/pool/page_workers.php
@@ -9,19 +9,25 @@ function worktitle($data, $user)
$pg .= '
Shares | ';
$pg .= 'Diff | ';
$pg .= 'Invalid | ';
+ $pg .= 'Block % | ';
$pg .= 'Hash Rate | ';
$pg .= "\n";
return $pg;
}
#
function workuser($data, $user, &$offset, &$totshare, &$totdiff,
- &$totinvalid, &$totrate, $old = false)
+ &$totinvalid, &$totrate, &$blockacc,
+ &$blockreward, $old = false)
{
$ans = getWorkers($user);
$pg = '';
if ($ans['STATUS'] == 'ok')
{
+ if (isset($ans['blockacc']))
+ $blockacc = $ans['blockacc'];
+ if (isset($ans['blockreward']))
+ $blockreward = $ans['blockreward'];
$count = $ans['rows'];
for ($i = 0; $i < $count; $i++)
{
@@ -60,6 +66,13 @@ function workuser($data, $user, &$offset, &$totshare, &$totdiff,
$pg .= "$rej% | ";
+ if ($blockacc <= 0)
+ $blkpct = ' ';
+ else
+ $blkpct = number_format(100.0 * $ans['w_diffacc:'.$i] / $blockacc, 3) . '%';
+
+ $pg .= "$blkpct | ";
+
if ($ans['w_elapsed:'.$i] > 3600)
$uhr = $ans['w_hashrate1hr:'.$i];
else
@@ -90,7 +103,7 @@ function workuser($data, $user, &$offset, &$totshare, &$totdiff,
return $pg;
}
#
-function worktotal($offset, $totshare, $totdiff, $totinvalid, $totrate)
+function worktotal($offset, $totshare, $totdiff, $totinvalid, $totrate, $blockacc, $blockreward)
{
$pg = '';
$totrate /= 10000000;
@@ -118,6 +131,11 @@ function worktotal($offset, $totshare, $totdiff, $totinvalid, $totrate)
else
$rej = '0';
$pg .= "$rej% | ";
+ if ($blockacc <= 0)
+ $blkpct = ' ';
+ else
+ $blkpct = number_format(100.0 * $totdiff / $blockacc, 3) . '%';
+ $pg .= "$blkpct | ";
$pg .= "$totrate | \n";
return $pg;
}
@@ -133,11 +151,22 @@ function doworker($data, $user)
$totinvalid = 0;
$totrate = 0;
$offset = 0;
+ $blockacc = 0;
+ $blockreward = 0;
$pg .= worktitle($data, $user);
$pg .= workuser($data, $user, $offset, $totshare, $totdiff, $totinvalid,
- $totrate, false);
- $pg .= worktotal($offset, $totshare, $totdiff, $totinvalid, $totrate);
+ $totrate, $blockacc, $blockreward, false);
+ $pg .= worktotal($offset, $totshare, $totdiff, $totinvalid, $totrate,
+ $blockacc, $blockreward);
+
+ if ($blockacc > 0 && $blockreward > 0)
+ {
+ $btc = btcfmt($totdiff / $blockacc * $blockreward);
+ $pg .= '';
+ $pg .= " Payout est if block found at 100%: ~$btc BTC";
+ $pg .= ' |
';
+ }
$pg .= "\n";
diff --git a/src/ckdb.c b/src/ckdb.c
index 91940cdd..fa6f2df8 100644
--- a/src/ckdb.c
+++ b/src/ckdb.c
@@ -49,7 +49,7 @@
#define DB_VLOCK "1"
#define DB_VERSION "0.9.2"
-#define CKDB_VERSION DB_VERSION"-0.331"
+#define CKDB_VERSION DB_VERSION"-0.332"
#define WHERE_FFL " - from %s %s() line %d"
#define WHERE_FFL_HERE __FILE__, __func__, __LINE__
@@ -240,13 +240,14 @@ static LOADSTATUS dbstatus;
typedef struct poolstatus {
int64_t workinfoid; // Last block
int32_t height;
+ int64_t reward;
double diffacc;
double diffinv; // Non-acc
double shareacc;
double shareinv; // Non-acc
double best_sdiff; // TODO (maybe)
} POOLSTATUS;
-static POOLSTATUS pool = { 0, START_POOL_HEIGHT, 0, 0, 0, 0, 0 };
+static POOLSTATUS pool = { 0, START_POOL_HEIGHT, 0, 0, 0, 0, 0, 0 };
/* TODO: when we know about orphans, the count reset to zero
* will need to be undone - i.e. recalculate this data from
* the memory tables - maybe ... */
@@ -4994,6 +4995,7 @@ static int64_t workinfo_add(PGconn *conn, char *workinfoidstr, char *poolinstanc
STRNCPY(row->bits, bits);
STRNCPY(row->ntime, ntime);
TXT_TO_BIGINT("reward", reward, row->reward);
+ pool.reward = row->reward;
HISTORYDATEINIT(row, cd, by, code, inet);
HISTORYDATETRANSFER(trf_root, row);
@@ -5524,6 +5526,7 @@ static bool workinfo_fill(PGconn *conn)
if (!ok)
break;
TXT_TO_BIGINT("reward", field, row->reward);
+ pool.reward = row->reward;
HISTORYDATEFLDS(res, i, row, ok);
if (!ok)
@@ -9795,6 +9798,13 @@ static char *cmd_workers(__maybe_unused PGconn *conn, char *cmd, char *id,
DATA_WORKERS_NULL(workers, w_item);
APPEND_REALLOC_INIT(buf, off, len);
APPEND_REALLOC(buf, off, len, "ok.");
+ snprintf(tmp, sizeof(tmp), "blockacc=%.1f%c",
+ pool.diffacc, FLDSEP);
+ APPEND_REALLOC(buf, off, len, tmp);
+ snprintf(tmp, sizeof(tmp), "blockreward=%"PRId64"%c",
+ pool.reward, FLDSEP);
+ APPEND_REALLOC(buf, off, len, tmp);
+
rows = 0;
while (w_item && workers->userid == users->userid) {
if (CURRENT(&(workers->expirydate))) {