Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pool: Add gominer 2.0.x support. #413

Merged
merged 1 commit into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading