diff --git a/src/p2p_server.h b/src/p2p_server.h index 0bcbc60..e458136 100644 --- a/src/p2p_server.h +++ b/src/p2p_server.h @@ -128,6 +128,7 @@ public: void print_status() override; void show_peers(); + size_t peer_list_size() const { return m_peerList.size(); } private: p2pool* m_pool; diff --git a/src/p2pool.cpp b/src/p2pool.cpp index 07e5a82..b3d7ed9 100644 --- a/src/p2pool.cpp +++ b/src/p2pool.cpp @@ -1013,7 +1013,7 @@ void p2pool::api_update_pool_stats() uint64_t t; const difficulty_type& diff = m_sideChain->difficulty(); const uint64_t hashrate = udiv128(diff.hi, diff.lo, m_sideChain->block_time(), &t); - const uint64_t miners = m_sideChain->miner_count(); + const uint64_t miners = std::max(m_sideChain->miner_count(), m_p2pServer ? m_p2pServer->peer_list_size() : 0U); const difficulty_type total_hashes = m_sideChain->total_hashes(); time_t last_block_found_time = 0; @@ -1076,7 +1076,7 @@ void p2pool::api_update_stats_mod() s << last_block_found_hash << '\0'; memcpy(last_block_found_buf + 4, "...", 4); - const uint64_t miners = m_sideChain->miner_count(); + const uint64_t miners = std::max(m_sideChain->miner_count(), m_p2pServer ? m_p2pServer->peer_list_size() : 0U); uint64_t t; const difficulty_type& diff = m_sideChain->difficulty(); diff --git a/src/side_chain.cpp b/src/side_chain.cpp index bc85ffd..6b801a1 100644 --- a/src/side_chain.cpp +++ b/src/side_chain.cpp @@ -757,9 +757,9 @@ uint64_t SideChain::miner_count() MutexLock lock(m_sidechainLock); - // Delete wallets that weren't seen for more than 48 hours and return how many remain + // Delete wallets that weren't seen for more than 72 hours and return how many remain for (auto it = m_seenWallets.begin(); it != m_seenWallets.end();) { - if (it->second + 48 * 60 * 60 <= cur_time) { + if (it->second + 72 * 60 * 60 <= cur_time) { it = m_seenWallets.erase(it); } else {