Files
AetherForge/server/internal/strategy/fleet_role.go
AetherForge 7b2d41cda8
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Expand P2 test coverage: mining chain, spread lanes, path forge, WS/beacon, E2E onion, file handling
2026-06-07 04:58:55 -07:00

35 lines
684 B
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package strategy
import "math"
// NormalizeFleetRole coerces miner|seeder|auto to a runtime role label.
func NormalizeFleetRole(role string) string {
switch role {
case "seeder", "miner":
return role
default:
return "auto"
}
}
// EmberwakeHeat returns 01 intensity for war-room heat maps from fleet role pressure fields.
func EmberwakeHeat(fleetRole string, seedPressure, hashratePressure float64) float64 {
if fleetRole == "seeder" {
return clamp01(seedPressure)
}
if hashratePressure > 0 {
return clamp01(hashratePressure)
}
return 0
}
func clamp01(v float64) float64 {
if v < 0 {
return 0
}
if v > 1 {
return 1
}
return math.Round(v*1000) / 1000
}