From 96c1f184f2b02d87526579d9ca246bdb47366566 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Thu, 12 Oct 2023 22:42:38 -0500 Subject: [PATCH] pool: Add gominer 2.0.x support. This adds gominer version 2.0.x as a supported mining client. --- internal/gui/assets/templates/index.html | 6 ++++-- pool/client.go | 2 +- pool/difficulty.go | 2 ++ pool/message.go | 2 +- pool/minerid.go | 10 ++++++---- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/internal/gui/assets/templates/index.html b/internal/gui/assets/templates/index.html index 7eb8e04d..534c03a2 100644 --- a/internal/gui/assets/templates/index.html +++ b/internal/gui/assets/templates/index.html @@ -62,8 +62,10 @@

Identify the Miner

diff --git a/pool/client.go b/pool/client.go index 2ad8fce5..6f84a2a2 100644 --- a/pool/client.go +++ b/pool/client.go @@ -1056,7 +1056,7 @@ func (c *Client) send() { c.mtx.RUnlock() switch miner { - case CPU, NiceHashValidator: + case CPU, Gominer, NiceHashValidator: c.sendWorkDefault(req, miner) log.Tracef("%s notified of new work", id) diff --git a/pool/difficulty.go b/pool/difficulty.go index e17100d5..c2c2ceff 100644 --- a/pool/difficulty.go +++ b/pool/difficulty.go @@ -19,6 +19,7 @@ import ( // Supported mining clients. const ( CPU = "cpu" + Gominer = "decred-gominer" NiceHashValidator = "nicehash" ) @@ -27,6 +28,7 @@ var ( // corresponding hash rates. minerHashes = map[string]*big.Int{ CPU: new(big.Int).SetInt64(5e3), + Gominer: new(big.Int).SetInt64(5e9), NiceHashValidator: new(big.Int).SetInt64(20e10), } ) diff --git a/pool/message.go b/pool/message.go index 3eea75c4..5fe616dc 100644 --- a/pool/message.go +++ b/pool/message.go @@ -605,7 +605,7 @@ func GenerateSolvedBlockHeader(headerE string, extraNonce1E string, headerEB := []byte(headerE) switch miner { - case CPU: + case CPU, Gominer: copy(headerEB[272:280], []byte(nTimeE)) copy(headerEB[280:288], []byte(nonceE)) copy(headerEB[288:296], []byte(extraNonce1E)) diff --git a/pool/minerid.go b/pool/minerid.go index 0ddbf6b3..bcc9845c 100644 --- a/pool/minerid.go +++ b/pool/minerid.go @@ -34,14 +34,16 @@ func newUserAgentRE(clientName string, clientMajor, clientMinor uint32) *regexp. var ( // These regular expressions are used to identify the expected mining // clients by the user agents in their mining.subscribe requests. - cpuRE = newUserAgentRE("cpuminer", 1, 0) - nhRE = newUserAgentRE("NiceHash", 1, 0) + cpuRE = newUserAgentRE("cpuminer", 1, 0) + gominerRE = newUserAgentRE("decred-gominer", 2, 0) + nhRE = newUserAgentRE("NiceHash", 1, 0) // miningClients maps regular expressions to the supported mining client IDs // for all user agents that match the regular expression. miningClients = map[*regexp.Regexp][]string{ - cpuRE: {CPU}, - nhRE: {NiceHashValidator}, + cpuRE: {CPU}, + gominerRE: {Gominer}, + nhRE: {NiceHashValidator}, } )