Browse Source

ckdb/php - add display format block hash to pblocks csv

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

11
pool/page_blocks.php

@ -58,6 +58,7 @@ function doblocks($data, $user)
{ {
$pg .= "<table callpadding=0 cellspacing=0 border=0>\n"; $pg .= "<table callpadding=0 cellspacing=0 border=0>\n";
$pg .= "<tr class=title>"; $pg .= "<tr class=title>";
$pg .= "<td class=dr>#</td>";
$pg .= "<td class=dl>Height</td>"; $pg .= "<td class=dl>Height</td>";
if ($user !== null) if ($user !== null)
$pg .= "<td class=dl>Who</td>"; $pg .= "<td class=dl>Who</td>";
@ -65,7 +66,7 @@ function doblocks($data, $user)
$pg .= "<td class=dc>When</td>"; $pg .= "<td class=dc>When</td>";
$pg .= "<td class=dr>Status</td>"; $pg .= "<td class=dr>Status</td>";
$pg .= "<td class=dr>Diff</td>"; $pg .= "<td class=dr>Diff</td>";
$pg .= "<td class=dr>%</td>"; $pg .= "<td class=dr>Diff%</td>";
$pg .= "<td class=dr>CDF</td>"; $pg .= "<td class=dr>CDF</td>";
$pg .= "</tr>\n"; $pg .= "</tr>\n";
} }
@ -73,12 +74,13 @@ function doblocks($data, $user)
$nettot = 0; $nettot = 0;
$i = 0; $i = 0;
$orph = false; $orph = false;
$csv = "Height,Status,Timestamp,DiffAcc,NetDiff\n"; $csv = "Sequence,Height,Status,Timestamp,DiffAcc,NetDiff,Hash\n";
if ($ans['STATUS'] == 'ok') if ($ans['STATUS'] == 'ok')
{ {
$count = $ans['rows']; $count = $ans['rows'];
for ($i = 0; $i < $count; $i++) for ($i = 0; $i < $count; $i++)
{ {
$seq = $count - $i;
if (($i % 2) == 0) if (($i % 2) == 0)
$row = 'even'; $row = 'even';
else else
@ -142,6 +144,7 @@ function doblocks($data, $user)
if ($wantcsv === false) if ($wantcsv === false)
{ {
$pg .= "<tr class=$row>"; $pg .= "<tr class=$row>";
$pg .= "<td class=dr$ex>$seq</td>";
$pg .= "<td class=dl$ex>$hifld</td>"; $pg .= "<td class=dl$ex>$hifld</td>";
if ($user !== null) if ($user !== null)
$pg .= "<td class=dl$ex>".htmlspecialchars($ans['workername:'.$i]).'</td>'; $pg .= "<td class=dl$ex>".htmlspecialchars($ans['workername:'.$i]).'</td>';
@ -155,11 +158,13 @@ function doblocks($data, $user)
} }
else else
{ {
$csv .= "$seq,";
$csv .= "$hi,"; $csv .= "$hi,";
$csv .= "\"$stat\","; $csv .= "\"$stat\",";
$csv .= $ans['firstcreatedate:'.$i].','; $csv .= $ans['firstcreatedate:'.$i].',';
$csv .= "$diffacc,"; $csv .= "$diffacc,";
$csv .= "$netdiff\n"; $csv .= "$netdiff,";
$csv .= $ans['blockhash:'.$i]."\n";
} }
} }
} }

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.781" #define CKDB_VERSION DB_VERSION"-0.782"
#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__

2
src/ckdb_cmd.c

@ -836,7 +836,7 @@ static char *cmd_blocklist(__maybe_unused PGconn *conn, char *cmd, char *id,
snprintf(tmp, sizeof(tmp), "height:%d=%s%c", rows, reply, FLDSEP); snprintf(tmp, sizeof(tmp), "height:%d=%s%c", rows, reply, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp); APPEND_REALLOC(buf, off, len, tmp);
str_to_buf(blocks->blockhash, reply, sizeof(reply)); dbhash2btchash(blocks->blockhash, reply, sizeof(reply));
snprintf(tmp, sizeof(tmp), "blockhash:%d=%s%c", rows, reply, FLDSEP); snprintf(tmp, sizeof(tmp), "blockhash:%d=%s%c", rows, reply, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp); APPEND_REALLOC(buf, off, len, tmp);

Loading…
Cancel
Save