|
|
|
@ -81,7 +81,17 @@ func (s *ProxyServer) processShare(login, id, ip string, t *BlockTemplate, param |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if s.config.Proxy.Debug { |
|
|
|
if s.config.Proxy.Debug { |
|
|
|
log.Printf("Difficulty pool/block/share = %d / %d / %d(%f) from %v@%v", shareDiff, t.Difficulty, shareDiffCalc, shareDiffFloat, login, ip) |
|
|
|
hashrateShareDiff := formatHashrate(shareDiffCalc) |
|
|
|
|
|
|
|
hashrateBlockDiff := formatHashrate(t.Difficulty.Int64()) // Konvertieren zu int64
|
|
|
|
|
|
|
|
hashrateShare := formatHashrate(shareDiff) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Ausgabe der formatierten Informationen in der Kommandozeile (cmd)
|
|
|
|
|
|
|
|
log.Printf("Mining Information:") |
|
|
|
|
|
|
|
log.Printf("Blockchain Height: %d", t.Height) // Geändert zu "Blockchain Height"
|
|
|
|
|
|
|
|
log.Printf("Pool Difficulty: %d (%s)", shareDiff, hashrateShare) |
|
|
|
|
|
|
|
log.Printf("Block Difficulty: %d (%s)", t.Difficulty.Int64(), hashrateBlockDiff) |
|
|
|
|
|
|
|
log.Printf("Share Difficulty: %d (%s)", shareDiffCalc, hashrateShareDiff) |
|
|
|
|
|
|
|
log.Printf("Submitted by: %v@%v", login, ip) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
h, ok := t.headers[hashNoNonce] |
|
|
|
h, ok := t.headers[hashNoNonce] |
|
|
|
@ -159,3 +169,15 @@ func (s *ProxyServer) processShare(login, id, ip string, t *BlockTemplate, param |
|
|
|
s.backend.WriteWorkerShareStatus(login, id, true, false, false) |
|
|
|
s.backend.WriteWorkerShareStatus(login, id, true, false, false) |
|
|
|
return false, true |
|
|
|
return false, true |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func formatHashrate(shareDiffCalc int64) string { |
|
|
|
|
|
|
|
units := []string{"H/s", "KH/s", "MH/s", "GH/s", "TH/s", "PH/s"} |
|
|
|
|
|
|
|
var i int |
|
|
|
|
|
|
|
diff := float64(shareDiffCalc) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for i = 0; i < len(units)-1 && diff >= 1000.0; i++ { |
|
|
|
|
|
|
|
diff /= 1000.0 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
formatted := strconv.FormatFloat(diff, 'f', 2, 64) |
|
|
|
|
|
|
|
return formatted + " " + units[i] |
|
|
|
|
|
|
|
} |
|
|
|
|