Skip to content

web(#919): per-node local_hashps series in /local_stats, honest-absent when cold - #1101

Open
frstrtr wants to merge 1 commit into
masterfrom
dashboard/local-hashrate-graph-919
Open

web(#919): per-node local_hashps series in /local_stats, honest-absent when cold#1101
frstrtr wants to merge 1 commit into
masterfrom
dashboard/local-hashrate-graph-919

Conversation

@frstrtr

@frstrtr frstrtr commented Aug 4, 2026

Copy link
Copy Markdown
Owner

#919 — per-node local hashrate series in /local_stats (honest-absent)

Problem

/api/local_stats exposed no per-node local hashrate. The only hashrate field was poolhashps (pool-wide attempts/s — the "Pool: X GH/s" figure). A local-hashrate graph therefore had no real series of this node's own work rate to poll.

Fix (additive)

Add local_hashps to MiningInterface::rest_local_stats (src/core/web_server.cpp), sourced from the real stratum work-rate counter m_stratum_hashrate_fn — the same live per-node source the node-fee local_hr leg already trusts, not the empty m_node stub that produced the founding poolhashps=0 lie.

Honest-absent, not flat zero: with no work-rate source wired the counter is cold and the field is null — an honest "unknown", never a 0 that would falsely claim the node mines nothing. A wired source reporting 0.0 is a true reading (no active local miners) and stays 0.

Every existing field is byte-identical; only the new key is added.

Source note for the merge gate

local_hashps is this node's local work rate (stratum counter), deliberately distinct from poolhashps (pool-wide). If the intent was instead to mirror the pool counter per-node, say so and I will repoint the source — the seam is one line.

Tests

src/core/test/web_server_local_hashps_test.cpp — 2 additive KATs, folded into the existing core_test target:

  • ColdCounterIsHonestNullNotZero — no source wired → local_hashps present and null (not 0).
  • LiveCounterSurfacesRealValue — source wired → local_hashps equals the real counter value.

Both FAIL without the source change (key absent → contains("local_hashps") is false), verified by reverting only web_server.cpp and rebuilding. With the fix: core_test 145/145 green.

…nt when cold

The /local_stats endpoint exposed no per-node local hashrate, so a
local-hashrate graph had no real series to poll: the only hashrate field
was poolhashps (pool-wide attempts/s, the Pool: X GH/s figure). Add
local_hashps, THIS node own work rate read from the real stratum
work-rate counter (m_stratum_hashrate_fn, the same live source the
node-fee local_hr leg already trusts), never the empty m_node stub that
gave us the founding poolhashps=0 lie.

Honest-absent: with no work-rate source wired the counter is COLD and we
emit null, never a flat 0 that would falsely claim the node mines
nothing; a wired source reporting 0.0 is a TRUE reading and stays 0.

Additive only: new key, every existing field byte-identical. Two KATs
lock both directions (cold->null, live->real value); both fail without
the source change (key absent). core_test 145/145 green.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant