web: report real c2pool peer count + pool hashrate in getinfo/getstats - #304
Merged
Conversation
getinfo() and getstats() read connections and poolhashps from the m_node accessors. In the embedded prod build m_node is the unpopulated enhanced_node stub whose get_connected_peers_count()/get_hashrate_stats() return 0, so the dashboard/API showed connections=0 and poolhashps=0 even with ~30 LTC peers and ~129 GH/s live -- two false no-peers/0-hashrate alarms. Prefer the live MiningInterface hooks (m_peer_info_fn for real c2pool share peers, m_pool_hashrate_fn for real attempts/s from the tracker) which are already wired in c2pool_refactored.cpp and consumed by rest_local_stats. Fall back to the m_node accessors when a hook is unset. Web/diagnostic layer only -- no consensus, sharechain, or wire change.
frstrtr
added a commit
that referenced
this pull request
Jun 23, 2026
web: report real c2pool peer count + pool hashrate in getinfo/getstats
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Operator hit two false "no peers / 0 hashrate" alarms: the dashboard/API (
getinfo/getstats) reportedconnections=0andpoolhashps=0while the node actually had ~30 LTC peers and ~129 GH/s live (visible in debug.log).Root cause
getinfo()/getstats()read peer count + hashrate from them_nodeaccessors (get_connected_peers_count()/get_hashrate_stats()). In the embedded prod buildm_nodeis the unpopulatedenhanced_nodestub object — those accessors return 0. The REAL values are already wired into the MiningInterface viam_peer_info_fn(real c2pool share peers) andm_pool_hashrate_fn(real attempts/s from get_pool_attempts_per_second), and are already trusted byrest_local_stats.Fix
getinfo/getstatsnow prefer the live hooks, falling back to them_nodeaccessor only when a hook is unset. Web/diagnostic layer only — no consensus / sharechain / wire change. Single-TU compile verified locally.Follow-up (NOT in this PR)
Separately-labeled embedded LTC and DOGE core-daemon peer counts. Their source is genuinely ambiguous (external litecoind/dogecoind RPC getpeerinfo vs embedded SPV single-peer vs merged coin_peer_manager) and I will not ship a third potentially-misleading number by guessing. Tracking separately; need a one-line confirm on the intended source.