ckpool: expose bestever in runtime socket JSON
Upstream ckpool tracks user/worker best_ever across block solves but only emits it in the on-disk users.json/workers.json persistence files, not in the runtime socket API (userinfo() / workerinfo() in stratifier.c). Consumers that poll the socket — like kamado-api — see bestdiff reset to zero on every block solve via reset_bestshares() with no all-time field to fall back on. That is the "best share stuck at zero after a block" UX we want to fix in Kamado. 0001-expose-bestever-in-runtime-json.patch adds bestever to the two JSON_CPACK calls so the UI can show current-round and all-time side by side. No behavioral change, no impact on share validation or block handling. Candidate for upstreaming. Also surfaces BestEver in api/internal/ckpool types (User, Worker). Gracefully degrades to 0 on an unpatched ckpool.
This commit is contained in:
@@ -35,12 +35,15 @@ type PoolStats struct {
|
||||
DSPS10080 float64 `json:"dsps10080"`
|
||||
}
|
||||
|
||||
// User is one entry in the `users` response.
|
||||
// User is one entry in the `users` response. BestEver is exposed by the
|
||||
// Kamado ckpool patch (patches/0001-expose-bestever-in-runtime-json.patch)
|
||||
// and will be 0 against an unpatched upstream ckpool.
|
||||
type User struct {
|
||||
User string `json:"user"`
|
||||
ID int64 `json:"id"`
|
||||
Workers int `json:"workers"`
|
||||
BestDiff float64 `json:"bestdiff"`
|
||||
BestEver float64 `json:"bestever"`
|
||||
DSPS1 float64 `json:"dsps1"`
|
||||
DSPS5 float64 `json:"dsps5"`
|
||||
DSPS60 float64 `json:"dsps60"`
|
||||
@@ -53,7 +56,8 @@ type UsersResponse struct {
|
||||
Users []User `json:"users"`
|
||||
}
|
||||
|
||||
// Worker is one entry in the `workers` response.
|
||||
// Worker is one entry in the `workers` response. BestEver requires the
|
||||
// Kamado ckpool patch; see User above.
|
||||
type Worker struct {
|
||||
User string `json:"user"`
|
||||
Worker string `json:"worker"`
|
||||
@@ -64,6 +68,7 @@ type Worker struct {
|
||||
DSPS1440 float64 `json:"dsps1440"`
|
||||
LastShare int64 `json:"lastshare"`
|
||||
BestDiff float64 `json:"bestdiff"`
|
||||
BestEver float64 `json:"bestever"`
|
||||
MinDiff float64 `json:"mindiff"`
|
||||
Idle bool `json:"idle"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user