Browse Source

ckdb/php - put the pool block # in the web block information

master
kanoi 10 years ago
parent
commit
55595f3855
  1. 5
      pool/page_blocks.php
  2. 2
      src/ckdb.h
  3. 15
      src/ckdb_cmd.c

5
pool/page_blocks.php

@ -96,10 +96,10 @@ function doblocks($data, $user)
$csv = "Sequence,Height,Status,Timestamp,DiffAcc,NetDiff,Hash\n"; $csv = "Sequence,Height,Status,Timestamp,DiffAcc,NetDiff,Hash\n";
if ($ans['STATUS'] == 'ok') if ($ans['STATUS'] == 'ok')
{ {
$tot = $ans['tot'];
$count = $ans['rows']; $count = $ans['rows'];
for ($i = 0; $i < $count; $i++) for ($i = 0; $i < $count; $i++)
{ {
$seq = $i + 1;
if (($i % 2) == 0) if (($i % 2) == 0)
$row = 'even'; $row = 'even';
else else
@ -114,7 +114,10 @@ function doblocks($data, $user)
{ {
$ex = 's'; $ex = 's';
$orph = true; $orph = true;
$seq = '';
} }
else
$seq = $tot--;
if ($stat == '1-Confirm') if ($stat == '1-Confirm')
{ {
if (isset($data['info']['lastheight'])) if (isset($data['info']['lastheight']))

2
src/ckdb.h

@ -52,7 +52,7 @@
#define DB_VLOCK "1" #define DB_VLOCK "1"
#define DB_VERSION "0.9.6" #define DB_VERSION "0.9.6"
#define CKDB_VERSION DB_VERSION"-0.902" #define CKDB_VERSION DB_VERSION"-0.903"
#define WHERE_FFL " - from %s %s() line %d" #define WHERE_FFL " - from %s %s() line %d"
#define WHERE_FFL_HERE __FILE__, __func__, __LINE__ #define WHERE_FFL_HERE __FILE__, __func__, __LINE__

15
src/ckdb_cmd.c

@ -819,7 +819,7 @@ static char *cmd_blocklist(__maybe_unused PGconn *conn, char *cmd, char *id,
size_t len, off; size_t len, off;
int32_t height = -1; int32_t height = -1;
tv_t first_cd = {0,0}; tv_t first_cd = {0,0};
int rows; int rows, tot;
LOGDEBUG("%s(): cmd '%s'", __func__, cmd); LOGDEBUG("%s(): cmd '%s'", __func__, cmd);
@ -828,6 +828,16 @@ static char *cmd_blocklist(__maybe_unused PGconn *conn, char *cmd, char *id,
rows = 0; rows = 0;
K_RLOCK(blocks_free); K_RLOCK(blocks_free);
b_item = last_in_ktree(blocks_root, ctx); b_item = last_in_ktree(blocks_root, ctx);
tot = 0;
while (b_item) {
DATA_BLOCKS(blocks, b_item);
if (CURRENT(&(blocks->expirydate))) {
if (blocks->confirmed[0] != BLOCKS_ORPHAN)
tot++;
}
b_item = prev_in_ktree(ctx);
}
b_item = last_in_ktree(blocks_root, ctx);
while (b_item && rows < 42) { while (b_item && rows < 42) {
DATA_BLOCKS(blocks, b_item); DATA_BLOCKS(blocks, b_item);
if (height != blocks->height) { if (height != blocks->height) {
@ -914,7 +924,8 @@ static char *cmd_blocklist(__maybe_unused PGconn *conn, char *cmd, char *id,
} }
K_RUNLOCK(blocks_free); K_RUNLOCK(blocks_free);
snprintf(tmp, sizeof(tmp), snprintf(tmp, sizeof(tmp),
"rows=%d%cflds=%s%c", "tot=%d%crows=%d%cflds=%s%c",
tot, FLDSEP,
rows, FLDSEP, rows, FLDSEP,
"height,blockhash,nonce,reward,workername,firstcreatedate," "height,blockhash,nonce,reward,workername,firstcreatedate,"
"createdate,status,diffacc,diffinv,shareacc,shareinv,elapsed," "createdate,status,diffacc,diffinv,shareacc,shareinv,elapsed,"

Loading…
Cancel
Save