Browse Source

ckdb/php - add block height to homepage blocks

master
kanoi 10 years ago
parent
commit
cdfbef578f
  1. 6
      pool/page.php
  2. 22
      src/ckdb.c

6
pool/page.php

@ -187,6 +187,9 @@ function pgtop($dotop, $user, $douser)
}
}
if (isset($info['lastblockheight']))
$plb .= ' ('.$info['lastblockheight'].')';
if (isset($info['lastbc']))
{
$nlb = $info['lastbc'];
@ -201,6 +204,9 @@ function pgtop($dotop, $user, $douser)
}
}
if (isset($info['lastheight']))
$nlb .= ' ('.$info['lastheight'].')';
if (isset($info['blockacc']))
{
$acc = $info['blockacc'];

22
src/ckdb.c

@ -8656,8 +8656,21 @@ static char *cmd_homepage(__maybe_unused PGconn *conn, char *cmd, char *id,
tvs_to_buf(&last_bc, reply, sizeof(reply));
snprintf(tmp, sizeof(tmp), "lastbc=%s%c", reply, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
if (workinfo_current) {
WORKINFO *wic;
int32_t hi;
DATA_WORKINFO(wic, workinfo_current);
hi = coinbase1height(wic->coinbase1);
snprintf(tmp, sizeof(tmp), "lastheight=%d%c",
hi-1, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
} else {
snprintf(tmp, sizeof(tmp), "lastheight=?%c", FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
}
} else {
snprintf(tmp, sizeof(tmp), "lastbc=?%c", FLDSEP);
snprintf(tmp, sizeof(tmp), "lastbc=?%clastheight=?%c",
FLDSEP, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
}
@ -8680,8 +8693,13 @@ static char *cmd_homepage(__maybe_unused PGconn *conn, char *cmd, char *id,
reply, FLDSEP,
blocks->confirmed, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
snprintf(tmp, sizeof(tmp), "lastblockheight=%d%c",
blocks->height, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
} else {
snprintf(tmp, sizeof(tmp), "lastblock=?%cconfirmed=?%c", FLDSEP, FLDSEP);
snprintf(tmp, sizeof(tmp), "lastblock=?%cconfirmed=?%c"
"lastblockheight=?%c",
FLDSEP, FLDSEP, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
}

Loading…
Cancel
Save