Skip to content

Commit

Permalink
pool: Add gominer 2.0.x support.
Browse files Browse the repository at this point in the history
This adds gominer version 2.0.x as a supported mining client.
  • Loading branch information
davecgh authored and jholdstock committed Oct 13, 2023
1 parent bc675d4 commit ef35d5e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
6 changes: 4 additions & 2 deletions internal/gui/assets/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,10 @@ <h2>Identify the Miner</h2>
</p>
<div class="d-flex flex-row">
<ul>
<li>
Coming Soon!
<li><a
rel="noopener noreferrer"
target="_blank"
href="https://github.com/decred/gominer">Gominer&nbsp;2.0.x</a>
</li>
</ul>
</div>
Expand Down
2 changes: 1 addition & 1 deletion pool/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 2 additions & 0 deletions pool/difficulty.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
// Supported mining clients.
const (
CPU = "cpu"
Gominer = "decred-gominer"
NiceHashValidator = "nicehash"
)

Expand All @@ -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),
}
)
Expand Down
2 changes: 1 addition & 1 deletion pool/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
10 changes: 6 additions & 4 deletions pool/minerid.go
Original file line number Diff line number Diff line change
Expand Up @@ -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},
}
)

Expand Down

0 comments on commit ef35d5e

Please sign in to comment.