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
+5 -2
View File
@@ -124,7 +124,7 @@ func TestUpdateEnrichment(t *testing.T) {
s := openTemp(t)
s.InsertBlock(Block{Height: 300, FoundAt: time.Now(), Chain: "main"})
if err := s.UpdateEnrichment(300, "newhash", 3.125); err != nil {
if err := s.UpdateEnrichment(300, "newhash", 3.125, "bc1qtest.rig1"); err != nil {
t.Fatalf("UpdateEnrichment: %v", err)
}
@@ -135,6 +135,9 @@ func TestUpdateEnrichment(t *testing.T) {
if blocks[0].RewardBT != 3.125 {
t.Errorf("RewardBT = %v, want 3.125", blocks[0].RewardBT)
}
if blocks[0].Miner != "bc1qtest.rig1" {
t.Errorf("Miner = %q, want bc1qtest.rig1", blocks[0].Miner)
}
}
func TestBlocksNeedingEnrichment(t *testing.T) {
@@ -146,7 +149,7 @@ func TestBlocksNeedingEnrichment(t *testing.T) {
// Block with hash but no reward → needs enrichment.
s.InsertBlock(Block{Height: 2, Hash: "abc", RewardBT: 0, FoundAt: now, Chain: "main"})
// Block fully enriched → does NOT need enrichment.
s.InsertBlock(Block{Height: 3, Hash: "def", RewardBT: 3.125, FoundAt: now, Chain: "main"})
s.InsertBlock(Block{Height: 3, Hash: "def", RewardBT: 3.125, FoundAt: now, Chain: "main", Miner: "bc1q.rig1"})
since := now.Add(-time.Hour)
missing, err := s.BlocksNeedingEnrichment(since)