Repository navigation
dashboard: add a "Pool at a glance" card to the overview - #99
Merged
Merged
Conversation
Ten headline tiles at the top of the overview: network hashrate, pool share, network difficulty, block height, next retarget, pool hashrate, blocks mined, coins mined, active users and fee. Network hashrate is measured from block arrivals in the templates table (the dashboard has no bitcoind RPC): each first template at a new height is a block arrival, and the work of those blocks is divided by the span the rows cover. Heights are compared to the running max so a reorg is not counted twice, and a gap counts every skipped height. With fewer than six arrivals it falls back to the difficulty-implied figure and says so, and pool share is only computed against a measured figure. fmtHashrate no longer renders sub-1 H/s values as "0.00 H/s", which a forknet's implied network hashrate would otherwise read as.
Block rewards were always labelled BTC, which on a forknet claims mainnet value the coins don't have. fmtBtc takes the symbol, and server.js binds it from COIN_SYMBOL (default BTC) for every public view that shows a reward: the overview and /blocks. "Workers hashing" on the at-a-glance card counted every worker with a share in the last 24h, the same as active workers, so a rig switched off this morning still read as hashing. It now counts workers with a share in the last 15 minutes (HASHING_WINDOW_SEC).
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.
Summary
Adds a headline stats card at the top of the overview page, laid out as two rows of five tiles:
24h · from N block timesreward_sats(after fee), inCOIN_SYMBOLfee_bpsNetwork hashrate
The dashboard has no bitcoind RPC, so
stats.networkHashrate()takes block times from thetemplatestable: the first template at a new height marks a block arrival. Hashrate is the work of those blocks (difficulty × 2^32) divided by the time span the rows cover.These are arrival times as the pool saw them, not header timestamps.
Other changes
fmtHashrateno longer renders sub-1 H/s values as0.00 H/s(a forknet's implied hashrate is about 0.003 H/s).COIN_SYMBOLenv var (defaultBTC) sets the unit for reward amounts on the overview and/blocks, e.g.COIN_SYMBOL=pECXon a forknet. Documented in the dashboard README and.env.example.nodeStatus()//api/nodenow carrynetwork_hashrate, the figure implied by difficulty.Test plan
npm testindashboard/: 204 pass, 0 failtest/headline-stats.test.jscovers: arrivals and span math, reorg and gap handling, the minimum-blocks fallback, the retarget boundary and regtest, active users and coins mined, and rendering both a populated and an empty poolCOIN_SYMBOL=pECX; the overview and/blocksshow pECX