Unify best-share semantics across leaderboard / miners / user page

BestShares read worker.bestdiff for its "Best (round)" column,
while MinersTable used client.bestdiff for online workers (and
worker.bestdiff only as a fallback for offline ones). ckpool
resets *both* fields in reset_bestshares() when the pool finds a
block, but reconnect / timing can leave them briefly divergent,
so the same worker could show different values in the two tables.

Switch every "session best" display to the same computation:

    max(client.bestdiff, worker.bestdiff)

…picking whichever is currently higher. Relabel the column from
"Best (round)" to "Best (session)" in MinersTable, BestShares, and
UserDetailPage so the meaning matches the value. UserDetailPage's
per-user summary tile used to show the user's round-best as a
sub-line; drop it, since it contradicts the "session" framing at
the row level.

Net effect: scroll between the leaderboard and the miners table
and the same worker's best-share number stays put.
This commit is contained in:
satoshi
2026-04-24 01:34:04 +03:00
parent 49c951f94f
commit 91902f38a0
3 changed files with 41 additions and 17 deletions
+9 -3
View File
@@ -35,14 +35,20 @@
const wname = c.workername || `${c.address}.unnamed`;
seen.add(wname);
const w = byWorker.get(wname);
// "Session best" is the larger of the live stratum client's
// best_diff and the worker_instance's best_diff. ckpool's
// reset_bestshares() clears both when the pool finds a block,
// but reconnect / timing can leave them briefly divergent —
// max() keeps this column aligned with the leaderboard.
const sessionBest = Math.max(c.bestdiff, w?.bestdiff ?? 0);
out.push({
workerName: wname,
user: c.address,
hardware: detectHardware(c.useragent),
hashrate1m: c.dsps1 * 2 ** 32,
hashrate1h: c.dsps60 * 2 ** 32,
bestDiff: c.bestdiff,
bestEver: w?.bestever ?? 0,
bestDiff: sessionBest,
bestEver: w?.bestever ?? sessionBest,
lastShare: c.lastshare,
difficulty: c.diff,
address: c.address,
@@ -88,7 +94,7 @@
<th class="num">Hashrate (1m)</th>
<th class="num">Hashrate (1h)</th>
<th class="num">Diff</th>
<th class="num">Best (round)</th>
<th class="num">Best (session)</th>
<th class="num">Best (ever)</th>
<th class="num">Last share</th>
</tr>