diff --git a/api/router.go b/api/router.go index 320d566..1eff0a2 100644 --- a/api/router.go +++ b/api/router.go @@ -125,7 +125,7 @@ func summaryResponse(p *proxy.Proxy) SummaryResponse { Expired: summary.Expired, AvgTime: summary.AvgTime, Latency: summary.AvgLatency, - HashesTotal: summary.Hashes, + HashesTotal: summary.HashesTotal, Best: summary.TopDiff, }, } @@ -142,7 +142,7 @@ func workersResponse(p *proxy.Proxy) any { record.Accepted, record.Rejected, record.Invalid, - record.Hashes, + record.HashesTotal, unixOrZero(record.LastHashAt), record.Hashrate(60), record.Hashrate(600), diff --git a/customdiffstats.go b/customdiffstats.go index 5ea9ed3..0511b03 100644 --- a/customdiffstats.go +++ b/customdiffstats.go @@ -7,11 +7,11 @@ import ( // CustomDiffBucketStats tracks per-custom-difficulty share outcomes. type CustomDiffBucketStats struct { - Accepted uint64 `json:"accepted"` - Rejected uint64 `json:"rejected"` - Invalid uint64 `json:"invalid"` - Expired uint64 `json:"expired"` - Hashes uint64 `json:"hashes_total"` + Accepted uint64 `json:"accepted"` + Rejected uint64 `json:"rejected"` + Invalid uint64 `json:"invalid"` + Expired uint64 `json:"expired"` + HashesTotal uint64 `json:"hashes_total"` } // CustomDiffBuckets records share totals grouped by miner custom difficulty. @@ -52,7 +52,7 @@ func (b *CustomDiffBuckets) OnAccept(e Event) { bucket.Expired++ } if e.Diff > 0 { - bucket.Hashes += e.Diff + bucket.HashesTotal += e.Diff } } diff --git a/customdiffstats_test.go b/customdiffstats_test.go index 7b5aef8..4d9bd99 100644 --- a/customdiffstats_test.go +++ b/customdiffstats_test.go @@ -23,7 +23,7 @@ func TestProxy_CustomDiffStats_Good(t *testing.T) { if !ok { t.Fatalf("expected custom diff bucket 50000 to be present") } - if bucket.Accepted != 1 || bucket.Expired != 1 || bucket.Hashes != 75 { + if bucket.Accepted != 1 || bucket.Expired != 1 || bucket.HashesTotal != 75 { t.Fatalf("unexpected bucket totals: %+v", bucket) } } diff --git a/state_impl.go b/state_impl.go index 5cd27c1..61186ef 100644 --- a/state_impl.go +++ b/state_impl.go @@ -645,7 +645,7 @@ func (p *Proxy) summaryDocument() summaryDocumentPayload { Expired: summary.Expired, AvgTime: summary.AvgTime, Latency: summary.AvgLatency, - HashesTotal: summary.Hashes, + HashesTotal: summary.HashesTotal, Best: summary.TopDiff, }, } @@ -662,7 +662,7 @@ func (p *Proxy) workersDocument() workersDocumentPayload { record.Accepted, record.Rejected, record.Invalid, - record.Hashes, + record.HashesTotal, unixOrZero(record.LastHashAt), record.Hashrate(60), record.Hashrate(600), @@ -1283,11 +1283,11 @@ func (s *Stats) Summary() StatsSummary { s.mu.Lock() defer s.mu.Unlock() summary := StatsSummary{ - Accepted: s.accepted.Load(), - Rejected: s.rejected.Load(), - Invalid: s.invalid.Load(), - Expired: s.expired.Load(), - Hashes: s.hashes.Load(), + Accepted: s.accepted.Load(), + Rejected: s.rejected.Load(), + Invalid: s.invalid.Load(), + Expired: s.expired.Load(), + HashesTotal: s.hashes.Load(), } if summary.Accepted > 0 { uptime := uint64(time.Since(s.startTime).Seconds()) @@ -1306,7 +1306,7 @@ func (s *Stats) Summary() StatsSummary { if i == HashrateWindowAll { uptime := time.Since(s.startTime).Seconds() if uptime > 0 { - summary.Hashrate[i] = float64(summary.Hashes) / uptime + summary.Hashrate[i] = float64(summary.HashesTotal) / uptime } continue } @@ -1441,7 +1441,7 @@ func (w *Workers) OnAccept(e Event) { } record := &w.entries[index] record.Accepted++ - record.Hashes += e.Diff + record.HashesTotal += e.Diff record.LastHashAt = time.Now().UTC() record.LastIP = e.Miner.ip for i := range record.windows { diff --git a/stats.go b/stats.go index f516767..3d2c60c 100644 --- a/stats.go +++ b/stats.go @@ -53,7 +53,7 @@ type StatsSummary struct { Rejected uint64 `json:"rejected"` Invalid uint64 `json:"invalid"` Expired uint64 `json:"expired"` - Hashes uint64 `json:"hashes_total"` + HashesTotal uint64 `json:"hashes_total"` AvgTime uint32 `json:"avg_time"` // seconds per accepted share AvgLatency uint32 `json:"latency"` // median pool response latency in ms Hashrate [6]float64 `json:"hashrate"` // H/s per window (index = HashrateWindow* constants) diff --git a/worker.go b/worker.go index ba76ee7..7592712 100644 --- a/worker.go +++ b/worker.go @@ -28,7 +28,7 @@ type WorkerRecord struct { Accepted uint64 Rejected uint64 Invalid uint64 - Hashes uint64 // sum of accepted share difficulties + HashesTotal uint64 // sum of accepted share difficulties LastHashAt time.Time windows [5]tickWindow // 60s, 600s, 3600s, 12h, 24h }