Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/core/web_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2837,6 +2837,18 @@ nlohmann::json MiningInterface::getinfo(const std::string& request_id)
connections = m_node->get_connected_peers_count();
}

// Prefer the live MiningInterface hooks over the m_node accessors.
// In the embedded prod build m_node is the unpopulated enhanced_node stub
// whose peer/hashrate accessors return 0 -- the source of the false
// "no peers / 0 hashrate" dashboard alarms. m_peer_info_fn (real c2pool
// share peers) and m_pool_hashrate_fn (real attempts/s) are wired live.
if (m_peer_info_fn) {
auto pi = m_peer_info_fn();
if (pi.is_array()) connections = pi.size();
}
if (double real_hs = get_pool_hashrate(); real_hs > 0.0)
pool_hashrate = real_hs;

// Read block height from cached template
uint64_t block_height = 0;
double network_hashps = 0.0;
Expand Down Expand Up @@ -2895,6 +2907,14 @@ nlohmann::json MiningInterface::getstats(const std::string& request_id)
difficulty = ds["global_pool_difficulty"];
}

// Prefer live hooks over the empty m_node stub (see getinfo above).
if (m_peer_info_fn) {
auto pi = m_peer_info_fn();
if (pi.is_array()) connected_peers = pi.size();
}
if (double real_hs = get_pool_hashrate(); real_hs > 0.0)
pool_hashrate = real_hs;

auto* pm = m_payout_manager_ptr ? m_payout_manager_ptr : m_payout_manager.get();
if (pm)
active_miners = pm->get_active_miners_count();
Expand Down
Loading