From 5f564e97d60278b8d638d6d8d0578d60b0391919 Mon Sep 17 00:00:00 2001 From: kanoi Date: Tue, 23 Dec 2014 08:55:29 +1100 Subject: [PATCH] ckdb/php - add display format block hash to pblocks csv --- pool/page_blocks.php | 11 ++++++++--- src/ckdb.h | 2 +- src/ckdb_cmd.c | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/pool/page_blocks.php b/pool/page_blocks.php index af7394ff..54233825 100644 --- a/pool/page_blocks.php +++ b/pool/page_blocks.php @@ -58,6 +58,7 @@ function doblocks($data, $user) { $pg .= "\n"; $pg .= ""; + $pg .= ""; $pg .= ""; if ($user !== null) $pg .= ""; @@ -65,7 +66,7 @@ function doblocks($data, $user) $pg .= ""; $pg .= ""; $pg .= ""; - $pg .= ""; + $pg .= ""; $pg .= ""; $pg .= "\n"; } @@ -73,12 +74,13 @@ function doblocks($data, $user) $nettot = 0; $i = 0; $orph = false; - $csv = "Height,Status,Timestamp,DiffAcc,NetDiff\n"; + $csv = "Sequence,Height,Status,Timestamp,DiffAcc,NetDiff,Hash\n"; if ($ans['STATUS'] == 'ok') { $count = $ans['rows']; for ($i = 0; $i < $count; $i++) { + $seq = $count - $i; if (($i % 2) == 0) $row = 'even'; else @@ -142,6 +144,7 @@ function doblocks($data, $user) if ($wantcsv === false) { $pg .= ""; + $pg .= ""; $pg .= ""; if ($user !== null) $pg .= "'; @@ -155,11 +158,13 @@ function doblocks($data, $user) } else { + $csv .= "$seq,"; $csv .= "$hi,"; $csv .= "\"$stat\","; $csv .= $ans['firstcreatedate:'.$i].','; $csv .= "$diffacc,"; - $csv .= "$netdiff\n"; + $csv .= "$netdiff,"; + $csv .= $ans['blockhash:'.$i]."\n"; } } } diff --git a/src/ckdb.h b/src/ckdb.h index b0dec28d..3d6bb698 100644 --- a/src/ckdb.h +++ b/src/ckdb.h @@ -52,7 +52,7 @@ #define DB_VLOCK "1" #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_HERE __FILE__, __func__, __LINE__ diff --git a/src/ckdb_cmd.c b/src/ckdb_cmd.c index 7e2dc96d..ecd43471 100644 --- a/src/ckdb_cmd.c +++ b/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); 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); APPEND_REALLOC(buf, off, len, tmp);
#HeightWhoWhenStatusDiff%Diff%CDF
$seq$hifld".htmlspecialchars($ans['workername:'.$i]).'