Add best share analysis page, miner column, and UI improvements

- Best share page: hex + binary hash comparison against network target,
  per-bit coloring showing exactly which bits prevented a valid block,
  toggle between network diff at time of finding vs current diff
- Capture best share hash from ckpool logs with one-time backfill
- Persist network difficulty at time of best share for historical accuracy
- Add miner (worker) column to blocks table via coinbase address matching
- Truncate block hashes in table with full hash on hover
- Increase hashrate chart Y-axis to 7 ticks for better readability
This commit is contained in:
satoshi
2026-05-18 17:19:35 +03:00
parent f1dc0a8a79
commit 1157f3501a
17 changed files with 1499 additions and 81 deletions
+33 -6
View File
@@ -19,6 +19,26 @@
);
const currentChain = $derived(snap.data?.chain?.chain ?? "");
function truncHash(hash: string): string {
if (!hash || hash.length <= 16) return hash;
return hash.slice(0, 8) + "…" + hash.slice(-8);
}
function minerLabel(miner: string | undefined): string {
if (!miner) return "—";
// Show address.worker truncated
const dot = miner.indexOf(".");
if (dot < 0) {
// Just an address, truncate middle
if (miner.length > 20) return miner.slice(0, 8) + "…" + miner.slice(-6);
return miner;
}
const addr = miner.slice(0, dot);
const worker = miner.slice(dot + 1);
const shortAddr = addr.length > 12 ? addr.slice(0, 6) + "…" + addr.slice(-4) : addr;
return shortAddr + "." + worker;
}
</script>
<section class="card">
@@ -31,6 +51,7 @@
<thead>
<tr>
<th>Height</th>
<th>Miner</th>
<th>Chain</th>
<th>Hash</th>
<th class="num">Reward</th>
@@ -47,6 +68,7 @@
<span class="orphan-tag" title="Reorged out of the canonical chain at {b.orphaned_at}">orphaned</span>
{/if}
</td>
<td class="miner-cell" title={b.miner ?? ""}>{minerLabel(b.miner)}</td>
<td>
{#if b.chain && currentChain && b.chain !== currentChain}
<span class="chain-tag" title="Mined on {displayChain(b.chain)} - current node is on {displayChain(currentChain)}">{displayChain(b.chain)}</span>
@@ -63,8 +85,8 @@
href="{explorerBase}/block/{b.hash}"
target="_blank"
rel="noopener noreferrer"
title="Open block on mempool.space"
>{b.hash}</a>
title={b.hash}
>{truncHash(b.hash)}</a>
{:else}
<span class="hash mono">&mdash;</span>
{/if}
@@ -100,11 +122,16 @@
.table-wrap {
overflow-x: auto;
}
.miner-cell {
font-size: 0.85em;
color: var(--fg-dim);
white-space: nowrap;
max-width: 180px;
overflow: hidden;
text-overflow: ellipsis;
}
.hash-cell {
/* Let the 64-char hash wrap inside the cell instead of stretching
* the whole table. */
max-width: 620px;
word-break: break-all;
white-space: nowrap;
}
.hash {
color: var(--fg-dim);