Include P2P peer list into miner count

pull/71/head
SChernykh 3 years ago
parent eaed654012
commit b56d027dd5

@ -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;

@ -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<uint64_t>(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<uint64_t>(m_sideChain->miner_count(), m_p2pServer ? m_p2pServer->peer_list_size() : 0U);
uint64_t t;
const difficulty_type& diff = m_sideChain->difficulty();

@ -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 {

Loading…
Cancel
Save