From dd0a35fb79b83af907302b52ff91dff9648dbd4f Mon Sep 17 00:00:00 2001 From: SChernykh Date: Sun, 5 Sep 2021 15:56:50 +0200 Subject: [PATCH] Show pool-side hashrate in status only when it's not zero --- src/log.h | 8 +++++++- src/side_chain.cpp | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/log.h b/src/log.h index e00614d..5b9db9f 100644 --- a/src/log.h +++ b/src/log.h @@ -299,15 +299,21 @@ template<> struct log::Stream::Entry struct Hashrate { - explicit FORCEINLINE Hashrate(uint64_t data) : m_data(data) {} + FORCEINLINE Hashrate() : m_data(0), m_valid(false) {} + explicit FORCEINLINE Hashrate(uint64_t data) : m_data(data), m_valid(true) {} uint64_t m_data; + bool m_valid; }; template<> struct log::Stream::Entry { static NOINLINE void put(Hashrate&& value, Stream* wrapper) { + if (!value.m_valid) { + return; + } + const double x = static_cast(value.m_data); static constexpr const char* units[] = { "H/s", "KH/s", "MH/s", "GH/s", "TH/s", "PH/s", "EH/s" }; diff --git a/src/side_chain.cpp b/src/side_chain.cpp index f2f8e55..e512c6a 100644 --- a/src/side_chain.cpp +++ b/src/side_chain.cpp @@ -651,7 +651,7 @@ void SideChain::print_status() "\nMain chain hashrate = " << log::Hashrate(network_hashrate) << "\nSide chain height = " << tip_height + 1 << "\nSide chain hashrate = " << log::Hashrate(pool_hashrate) << - "\nYour hashrate (pool-side) = " << log::Hashrate(hashrate_est) << + (hashrate_est ? "\nYour hashrate (pool-side) = " : "") << (hashrate_est ? log::Hashrate(hashrate_est) : log::Hashrate()) << "\nPPLNS window = " << total_blocks_in_window << " blocks (+" << total_uncles_in_window << " uncles, " << total_orphans << " orphans)" "\nYour shares = " << our_blocks_in_window << " blocks (+" << our_uncles_in_window << " uncles, " << our_orphans << " orphans)" "\nBlock reward share (est) = " << log::XMRAmount(reward_share)