Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
46 lines
1.2 KiB
Go
46 lines
1.2 KiB
Go
package atlas
|
|
|
|
import "strings"
|
|
|
|
// subtreeForTier maps a failed parent tier to mining tiers that should be hard-skipped.
|
|
var subtreeForTier = map[string][]string{
|
|
"ps_inmemory": {"ps_inmemory"},
|
|
"powershell": {"ps_inmemory"},
|
|
"dotnet": {"dotnet"},
|
|
"exe_subprocess": {"exe_subprocess"},
|
|
"wsl": {"wsl"},
|
|
"container": {"container", "docker_load"},
|
|
"docker_load": {"docker_load", "container"},
|
|
"docker": {"container", "docker_load"},
|
|
"gpu_subprocess": {"gpu_subprocess", "gpu_compute"},
|
|
"gpu_compute": {"gpu_compute", "gpu_subprocess"},
|
|
"stratum_direct": {"stratum_direct"},
|
|
"wmi": {"wmi"},
|
|
"scheduled_task": {"scheduled_task"},
|
|
}
|
|
|
|
func normalizeTier(tier string) string {
|
|
return strings.ToLower(strings.TrimSpace(tier))
|
|
}
|
|
|
|
func subtreeTiers(tier string) []string {
|
|
key := normalizeTier(tier)
|
|
if branch, ok := subtreeForTier[key]; ok {
|
|
return append([]string(nil), branch...)
|
|
}
|
|
if key != "" {
|
|
return []string{key}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func tierInSubtree(target, parent string) bool {
|
|
target = normalizeTier(target)
|
|
for _, t := range subtreeTiers(parent) {
|
|
if normalizeTier(t) == target {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|