Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable stratum diff, block refresh, and extranonce #59

Merged
merged 10 commits into from
Dec 13, 2022
Prev Previous commit
Next Next commit
Allow more space for uptime in stats
  • Loading branch information
rdugan committed Oct 21, 2022
commit 51df1c9bdb072fc251b273c5cf11a9a28bef607a
14 changes: 7 additions & 7 deletions src/kaspastratum/share_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,27 +269,27 @@ func (sh *shareHandler) startStatsThread() error {
// console formatting is terrible. Good luck whever touches anything
time.Sleep(10 * time.Second)
sh.statsLock.Lock()
str := "\n==============================================================================\n"
str += " worker name | avg hashrate | acc/stl/inv | blocks | uptime \n"
str += "------------------------------------------------------------------------------\n"
str := "\n===============================================================================\n"
str += " worker name | avg hashrate | acc/stl/inv | blocks | uptime \n"
str += "-------------------------------------------------------------------------------\n"
var lines []string
totalRate := float64(0)
for _, v := range sh.stats {
rate := GetAverageHashrateGHs(v)
totalRate += rate
rateStr := fmt.Sprintf("%0.2fGH/s", rate) // todo, fix units
ratioStr := fmt.Sprintf("%d/%d/%d", v.SharesFound.Load(), v.StaleShares.Load(), v.InvalidShares.Load())
lines = append(lines, fmt.Sprintf(" %-15s| %14.14s | %14.14s | %14d | %8.8s",
lines = append(lines, fmt.Sprintf(" %-15s| %14.14s | %14.14s | %12d | %11s",
v.WorkerName, rateStr, ratioStr, v.BlocksFound.Load(), time.Since(v.StartTime).Round(time.Second)))
}
sort.Strings(lines)
str += strings.Join(lines, "\n")
rateStr := fmt.Sprintf("%0.2fGH/s", totalRate) // todo, fix units
ratioStr := fmt.Sprintf("%d/%d/%d", sh.overall.SharesFound.Load(), sh.overall.StaleShares.Load(), sh.overall.InvalidShares.Load())
str += "\n------------------------------------------------------------------------------\n"
str += fmt.Sprintf(" | %14.14s | %14.14s | %14d | %8.8s",
str += "\n-------------------------------------------------------------------------------\n"
str += fmt.Sprintf(" | %14.14s | %14.14s | %12d | %11s",
rateStr, ratioStr, sh.overall.BlocksFound.Load(), time.Since(start).Round(time.Second))
str += "\n========================================================= ks_bridge_" + version + " ===\n"
str += "\n========================================================== ks_bridge_" + version + " ===\n"
sh.statsLock.Unlock()
log.Println(str)
}
Expand Down