From 512cfabd0a2652336f5c4223a1948630f3d3b79b Mon Sep 17 00:00:00 2001 From: Jethro Grassie Date: Sun, 12 May 2019 17:31:54 -0400 Subject: [PATCH] float to double for rounding issues --- src/pool.c | 8 ++++---- src/webui-embed.html | 2 ++ src/webui.c | 2 +- src/webui.h | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/pool.c b/src/pool.c index 35ce2e6..e2fa97e 100644 --- a/src/pool.c +++ b/src/pool.c @@ -127,9 +127,9 @@ typedef struct config_t uint32_t wallet_rpc_port; char pool_wallet[ADDRESS_MAX]; uint64_t pool_start_diff; - float share_mul; - float pool_fee; - float payment_threshold; + double share_mul; + double pool_fee; + double payment_threshold; uint32_t pool_port; uint32_t log_level; uint32_t webui_port; @@ -2358,7 +2358,7 @@ read_config(const char *config_file, const char *log_file, bool block_notified) log_info("\nCONFIG:\n rpc_host = %s\n rpc_port = %u\n " "rpc_timeout = %u\n pool_wallet = %s\n " "pool_start_diff = %"PRIu64"\n share_mul = %.2f\n " - "pool_fee = %.2f\n payment_threshold = %.2f\n " + "pool_fee = %.3f\n payment_threshold = %.2f\n " "wallet_rpc_host = %s\n wallet_rpc_port = %u\n pool_port = %u\n " "log_level = %u\n webui_port=%u\n " "log-file = %s\n block-notified = %u\n", diff --git a/src/webui-embed.html b/src/webui-embed.html index 8e0d6cf..b49c456 100644 --- a/src/webui-embed.html +++ b/src/webui-embed.html @@ -111,6 +111,8 @@ el.innerHTML = format_last_time(stats[e]); else if (/hashrate/.test(e)) el.innerHTML = format_hashrate(stats[e]); + else if (e == "pool_fee") + el.innerHTML = (stats[e]*100) + "%"; else el.innerHTML = stats[e]; } diff --git a/src/webui.c b/src/webui.c index 9e7fe48..64fc8f5 100644 --- a/src/webui.c +++ b/src/webui.c @@ -94,7 +94,7 @@ send_json_stats (void *cls, struct MHD_Connection *connection) "\"last_block_found\":%"PRIu64"," "\"pool_blocks_found\":%d," "\"payment_threshold\":%.2f," - "\"pool_fee\":%.2f," + "\"pool_fee\":%.3f," "\"pool_port\":%d," "\"connected_miners\":%d," "\"miner_hashrate\":%"PRIu64"," diff --git a/src/webui.h b/src/webui.h index 47af75c..c1eb5c1 100644 --- a/src/webui.h +++ b/src/webui.h @@ -51,8 +51,8 @@ typedef struct wui_context_t { uint32_t port; pool_stats_t *pool_stats; - float pool_fee; - float payment_threshold; + double pool_fee; + double payment_threshold; uint32_t pool_port; } wui_context_t;