From 7057da5dce4ed73b616b80cc78a634b7d2110093 Mon Sep 17 00:00:00 2001 From: kanoi Date: Mon, 2 Nov 2015 12:09:45 +1100 Subject: [PATCH] ckdb - fix the % character position in the block message --- src/ckdb.h | 2 +- src/ckdb_dbio.c | 16 +++++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/ckdb.h b/src/ckdb.h index 932e4777..3b458a0d 100644 --- a/src/ckdb.h +++ b/src/ckdb.h @@ -55,7 +55,7 @@ #define DB_VLOCK "1" #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_HERE __FILE__, __func__, __LINE__ diff --git a/src/ckdb_dbio.c b/src/ckdb_dbio.c index d60fa1f1..90e16fb3 100644 --- a/src/ckdb_dbio.c +++ b/src/ckdb_dbio.c @@ -5004,8 +5004,8 @@ flail: char est[16] = ""; char diff[16] = ""; K_ITEM *w_item; - char tmp[256]; - bool blk; + char tmp[256] = ""; + bool blk = false; suffix_string(hash_diff, diff, sizeof(diff)-1, 0); @@ -5017,20 +5017,20 @@ flail: break; case BLOCKS_CONFIRM: 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); if (w_item) { WORKINFO *workinfo; DATA_WORKINFO(workinfo, w_item); if (workinfo->diff_target > 0.0) { - snprintf(pct, sizeof(pct), "%.2f", + snprintf(pct, sizeof(pct), "%.2f%% ", 100.0 * pool.diffacc / 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)); snprintf(tmp, sizeof(tmp), " Reward: %f, Worker: %s, ShareEst: %.1f %s%sUTC:%s", @@ -5048,8 +5048,6 @@ flail: case BLOCKS_REJECT: case BLOCKS_42: default: - blk = false; - tmp[0] = '\0'; break; }