Browse Source

ckdb - ensure each block's workinfo is loaded

master
kanoi 10 years ago
parent
commit
c178d6b3bb
  1. 2
      src/ckdb.h
  2. 6
      src/ckdb_dbio.c

2
src/ckdb.h

@ -52,7 +52,7 @@
#define DB_VLOCK "1" #define DB_VLOCK "1"
#define DB_VERSION "0.9.2" #define DB_VERSION "0.9.2"
#define CKDB_VERSION DB_VERSION"-0.600" #define CKDB_VERSION DB_VERSION"-0.601"
#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__

6
src/ckdb_dbio.c

@ -2266,11 +2266,13 @@ bool workinfo_fill(PGconn *conn)
"workinfoid,poolinstance,merklehash,prevhash," "workinfoid,poolinstance,merklehash,prevhash,"
"coinbase1,coinbase2,version,bits,ntime,reward" "coinbase1,coinbase2,version,bits,ntime,reward"
HISTORYDATECONTROL HISTORYDATECONTROL
" from workinfo where workinfoid>=$1 and workinfoid<=$2 and expirydate=$3"; " from workinfo where expirydate=$1 and"
" ((workinfoid>=$2 and workinfoid<=$3) or"
" workinfoid in (select workinfoid from blocks) )";
par = 0; par = 0;
params[par++] = tv_to_buf((tv_t *)(&default_expiry), NULL, 0);
params[par++] = bigint_to_buf(dbload_workinfoid_start, NULL, 0); params[par++] = bigint_to_buf(dbload_workinfoid_start, NULL, 0);
params[par++] = bigint_to_buf(dbload_workinfoid_finish, NULL, 0); params[par++] = bigint_to_buf(dbload_workinfoid_finish, NULL, 0);
params[par++] = tv_to_buf((tv_t *)(&default_expiry), NULL, 0);
PARCHK(par, params); PARCHK(par, params);
res = PQexecParams(conn, sel, par, NULL, (const char **)params, NULL, NULL, 0, CKPQ_READ); res = PQexecParams(conn, sel, par, NULL, (const char **)params, NULL, NULL, 0, CKPQ_READ);
rescode = PQresultStatus(res); rescode = PQresultStatus(res);

Loading…
Cancel
Save