Browse Source

ckdb/php - add more pplns info and fix a ckdb corruption

master
kanoi 10 years ago
parent
commit
05f5cfd27b
  1. 11
      pool/page_pplns.php
  2. 20
      src/ckdb.c

11
pool/page_pplns.php

@ -44,22 +44,29 @@ Block: <input type=text name=blk size=10 value=''>
return '<font color=red size=+1><br>'.$ans['STATUS'].': '.$ans['ERROR'].'</font>';
$data = array( 'Block' => 'block',
'Block Hash' => 'block_hash',
'Block Reward (Satoshis)' => 'block_reward',
'PPLNS Wanted' => 'diff_want',
'PPLNS Used' => 'diffacc_total',
'Elapsed Seconds' => 'pplns_elapsed',
'Users' => 'rows',
'Oldest Workinfoid' => 'begin_workinfoid',
'Oldest Time' => 'begin_stamp',
'Oldest Epoch' => 'begin_epoch',
'Block Workinfoid' => 'block_workinfoid',
'Block Time' => 'block_stamp',
'Block Epoch' => 'block_epoch',
'Newest Workinfoid' => 'end_workinfoid',
'Newest Time' => 'end_stamp',
'Newest Share Time' => 'end_stamp',
'Newest Share Epoch' => 'end_epoch',
'Network Difficulty' => 'block_ndiff',
'PPLNS Factor' => 'diff_times',
'PPLNS Added' => 'diff_add',
'Share Count' => 'share_count');
$pg = "<br><table callpadding=0 cellspacing=0 border=0>\n";
$pg = '<br><a href=https://blockchain.info/block-height/';
$pg .= $ans['block'].'>Blockchain '.$ans['block']."</a><br>\n";
$pg .= "<br><table callpadding=0 cellspacing=0 border=0>\n";
$pg .= '<tr class=title>';
$pg .= '<td class=dl>Name</td>';
$pg .= '<td class=dr>Value</td>';

20
src/ckdb.c

@ -47,7 +47,7 @@
#define DB_VLOCK "1"
#define DB_VERSION "0.7"
#define CKDB_VERSION DB_VERSION"-0.71"
#define CKDB_VERSION DB_VERSION"-0.100"
#define WHERE_FFL " - from %s %s() line %d"
#define WHERE_FFL_HERE __FILE__, __func__, __LINE__
@ -5080,7 +5080,7 @@ static bool blocks_fill(PGconn *conn)
PQ_GET_FLD(res, i, "workername", field, ok);
if (!ok)
break;
TXT_TO_BLOB("workername", field, row->workername);
TXT_TO_STR("workername", field, row->workername);
PQ_GET_FLD(res, i, "clientid", field, ok);
if (!ok)
@ -5573,7 +5573,7 @@ static bool auths_fill(PGconn *conn)
PQ_GET_FLD(res, i, "enonce1", field, ok);
if (!ok)
break;
TXT_TO_BLOB("enonce1", field, row->enonce1);
TXT_TO_STR("enonce1", field, row->enonce1);
PQ_GET_FLD(res, i, "useragent", field, ok);
if (!ok)
@ -8352,6 +8352,14 @@ static char *cmd_pplns(__maybe_unused PGconn *conn, char *cmd, char *id,
APPEND_REALLOC(buf, off, len, "ok.");
snprintf(tmp, sizeof(tmp), "block=%d%c", height, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
snprintf(tmp, sizeof(tmp), "block_hash=%s%c", DATA_BLOCKS(b_item)->blockhash, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
snprintf(tmp, sizeof(tmp), "block_reward=%"PRId64"%c", DATA_BLOCKS(b_item)->reward, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
snprintf(tmp, sizeof(tmp), "workername=%s%c", DATA_BLOCKS(b_item)->workername, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
snprintf(tmp, sizeof(tmp), "nonce=%s%c", DATA_BLOCKS(b_item)->nonce, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
snprintf(tmp, sizeof(tmp), "begin_workinfoid=%"PRId64"%c", begin_workinfoid, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
snprintf(tmp, sizeof(tmp), "block_workinfoid=%"PRId64"%c", workinfoid, FLDSEP);
@ -8401,12 +8409,18 @@ static char *cmd_pplns(__maybe_unused PGconn *conn, char *cmd, char *id,
tv_to_buf(&begin_tv, tv_buf, sizeof(tv_buf));
snprintf(tmp, sizeof(tmp), "begin_stamp=%s%c", tv_buf, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
snprintf(tmp, sizeof(tmp), "begin_epoch=%ld%c", begin_tv.tv_sec, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
tv_to_buf(&block_tv, tv_buf, sizeof(tv_buf));
snprintf(tmp, sizeof(tmp), "block_stamp=%s%c", tv_buf, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
snprintf(tmp, sizeof(tmp), "block_epoch=%ld%c", block_tv.tv_sec, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
tv_to_buf(&end_tv, tv_buf, sizeof(tv_buf));
snprintf(tmp, sizeof(tmp), "end_stamp=%s%c", tv_buf, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
snprintf(tmp, sizeof(tmp), "end_epoch=%ld%c", end_tv.tv_sec, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
snprintf(tmp, sizeof(tmp), "block_ndiff=%f%c", ndiff, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);

Loading…
Cancel
Save