@@ -2837,6 +2837,18 @@ nlohmann::json MiningInterface::getinfo(const std::string& request_id)
28372837 connections = m_node->get_connected_peers_count ();
28382838 }
28392839
2840+ // Prefer the live MiningInterface hooks over the m_node accessors.
2841+ // In the embedded prod build m_node is the unpopulated enhanced_node stub
2842+ // whose peer/hashrate accessors return 0 -- the source of the false
2843+ // "no peers / 0 hashrate" dashboard alarms. m_peer_info_fn (real c2pool
2844+ // share peers) and m_pool_hashrate_fn (real attempts/s) are wired live.
2845+ if (m_peer_info_fn) {
2846+ auto pi = m_peer_info_fn ();
2847+ if (pi.is_array ()) connections = pi.size ();
2848+ }
2849+ if (double real_hs = get_pool_hashrate (); real_hs > 0.0 )
2850+ pool_hashrate = real_hs;
2851+
28402852 // Read block height from cached template
28412853 uint64_t block_height = 0 ;
28422854 double network_hashps = 0.0 ;
@@ -2895,6 +2907,14 @@ nlohmann::json MiningInterface::getstats(const std::string& request_id)
28952907 difficulty = ds[" global_pool_difficulty" ];
28962908 }
28972909
2910+ // Prefer live hooks over the empty m_node stub (see getinfo above).
2911+ if (m_peer_info_fn) {
2912+ auto pi = m_peer_info_fn ();
2913+ if (pi.is_array ()) connected_peers = pi.size ();
2914+ }
2915+ if (double real_hs = get_pool_hashrate (); real_hs > 0.0 )
2916+ pool_hashrate = real_hs;
2917+
28982918 auto * pm = m_payout_manager_ptr ? m_payout_manager_ptr : m_payout_manager.get ();
28992919 if (pm)
29002920 active_miners = pm->get_active_miners_count ();
0 commit comments