Browse Source

ckdb - fix the % character position in the block message

master
kanoi 9 years ago
parent
commit
7057da5dce
  1. 2
      src/ckdb.h
  2. 16
      src/ckdb_dbio.c

2
src/ckdb.h

@ -55,7 +55,7 @@
#define DB_VLOCK "1" #define DB_VLOCK "1"
#define DB_VERSION "1.0.4" #define DB_VERSION "1.0.4"
#define CKDB_VERSION DB_VERSION"-1.504" #define CKDB_VERSION DB_VERSION"-1.505"
#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__

16
src/ckdb_dbio.c

@ -5004,8 +5004,8 @@ flail:
char est[16] = ""; char est[16] = "";
char diff[16] = ""; char diff[16] = "";
K_ITEM *w_item; K_ITEM *w_item;
char tmp[256]; char tmp[256] = "";
bool blk; bool blk = false;
suffix_string(hash_diff, diff, sizeof(diff)-1, 0); suffix_string(hash_diff, diff, sizeof(diff)-1, 0);
@ -5017,20 +5017,20 @@ flail:
break; break;
case BLOCKS_CONFIRM: case BLOCKS_CONFIRM:
blk = true; blk = true;
if (pool.diffacc >= 1000.0) {
suffix_string(pool.diffacc, est, sizeof(est)-2, 0);
strcat(est, " ");
}
w_item = find_workinfo(row->workinfoid, NULL); w_item = find_workinfo(row->workinfoid, NULL);
if (w_item) { if (w_item) {
WORKINFO *workinfo; WORKINFO *workinfo;
DATA_WORKINFO(workinfo, w_item); DATA_WORKINFO(workinfo, w_item);
if (workinfo->diff_target > 0.0) { if (workinfo->diff_target > 0.0) {
snprintf(pct, sizeof(pct), "%.2f", snprintf(pct, sizeof(pct), "%.2f%% ",
100.0 * pool.diffacc / 100.0 * pool.diffacc /
workinfo->diff_target); workinfo->diff_target);
} }
} }
if (pool.diffacc >= 1000.0) {
suffix_string(pool.diffacc, est, sizeof(est)-1, 0);
strcat(est, "% ");
}
tv_to_buf(&(row->createdate), cd_buf, sizeof(cd_buf)); tv_to_buf(&(row->createdate), cd_buf, sizeof(cd_buf));
snprintf(tmp, sizeof(tmp), snprintf(tmp, sizeof(tmp),
" Reward: %f, Worker: %s, ShareEst: %.1f %s%sUTC:%s", " Reward: %f, Worker: %s, ShareEst: %.1f %s%sUTC:%s",
@ -5048,8 +5048,6 @@ flail:
case BLOCKS_REJECT: case BLOCKS_REJECT:
case BLOCKS_42: case BLOCKS_42:
default: default:
blk = false;
tmp[0] = '\0';
break; break;
} }

Loading…
Cancel
Save