decred / gominer

Go (golang) based GPU miner for Decred.
GNU General Public License v3.0
160 stars 80 forks source link

Switch to standalone upstream CUDA libs. #137

Closed jcvernaleo closed 7 years ago

jcvernaleo commented 7 years ago

Update all deps.

Closes #133

jolan commented 7 years ago

Some of the hash functions in dcrd were renamed so that needs to be addressed too. This seems to work for me (only tested w/stratum):

diff --git a/device.go b/device.go
index c63557a..1d89fe9 100644
--- a/device.go
+++ b/device.go
@@ -275,11 +275,11 @@ func (d *Device) foundCandidate(ts, nonce0, nonce1 uint32) {
        binary.BigEndian.PutUint32(data[128+4*work.TimestampWord:], ts)
        binary.BigEndian.PutUint32(data[128+4*work.Nonce0Word:], nonce0)
        binary.BigEndian.PutUint32(data[128+4*work.Nonce1Word:], nonce1)
-       hash := chainhash.HashFuncH(data[0:180])
+       hash := chainhash.HashH(data[0:180])

        // Hashes that reach this logic and fail the minimal proof of
        // work check are considered to be hardware errors.
-       hashNum := blockchain.ShaHashToBig(&hash)
+       hashNum := blockchain.HashToBig(&hash)
        if hashNum.Cmp(chainParams.PowLimit) > 0 {
                minrLog.Errorf("DEV #%d Hardware error found, hash %v above "+
                        "minimum target %064x", d.index, hash, d.work.Target.Bytes())
diff --git a/stratum/stratum.go b/stratum/stratum.go
index 53e47d8..fc68025 100644
--- a/stratum/stratum.go
+++ b/stratum/stratum.go
@@ -948,7 +948,7 @@ func (s *Stratum) PrepWork() error {
 func (s *Stratum) PrepSubmit(data []byte) (Submit, error) {
        log.Debugf("Stratum got valid work to submit %x", data)
        log.Debugf("Stratum got valid work hash %v",
-               chainhash.HashFuncH(data[0:180]))
+               chainhash.HashH(data[0:180]))
        data2 := make([]byte, 180)
        copy(data2, data[0:180])
jcvernaleo commented 7 years ago

Yeah, that should teach me not to rush when doing a simple PR. Should be all fixed now.