Expand P2 test coverage: mining chain, spread lanes, path forge, WS/beacon, E2E onion, file handling
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
This commit is contained in:
34
server/internal/strategy/fleet_role.go
Normal file
34
server/internal/strategy/fleet_role.go
Normal file
@@ -0,0 +1,34 @@
|
||||
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 0–1 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
|
||||
}
|
||||
Reference in New Issue
Block a user