web(#919): per-node local_hashps series in /local_stats, honest-absent when cold - #1101
Open
frstrtr wants to merge 1 commit into
Open
web(#919): per-node local_hashps series in /local_stats, honest-absent when cold#1101frstrtr wants to merge 1 commit into
frstrtr wants to merge 1 commit into
Conversation
…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.
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.
#919 — per-node local hashrate series in /local_stats (honest-absent)
Problem
/api/local_statsexposed no per-node local hashrate. The only hashrate field waspoolhashps(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_hashpstoMiningInterface::rest_local_stats(src/core/web_server.cpp), sourced from the real stratum work-rate counterm_stratum_hashrate_fn— the same live per-node source the node-feelocal_hrleg already trusts, not the emptym_nodestub that produced the foundingpoolhashps=0lie.Honest-absent, not flat zero: with no work-rate source wired the counter is cold and the field is
null— an honest "unknown", never a0that would falsely claim the node mines nothing. A wired source reporting0.0is a true reading (no active local miners) and stays0.Every existing field is byte-identical; only the new key is added.
Source note for the merge gate
local_hashpsis this node's local work rate (stratum counter), deliberately distinct frompoolhashps(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 existingcore_testtarget:ColdCounterIsHonestNullNotZero— no source wired →local_hashpspresent andnull(not0).LiveCounterSurfacesRealValue— source wired →local_hashpsequals the real counter value.Both FAIL without the source change (key absent →
contains("local_hashps")is false), verified by reverting onlyweb_server.cppand rebuilding. With the fix:core_test145/145 green.