Don't output every hash onto console, its too slow
Mining is about 3 times faster in average on my computer with this patch.
This commit is contained in:
parent
cb32e7ca13
commit
989569ce61
|
@ -56,7 +56,9 @@ func (pow *ProofOfWork) Run() (int, []byte) {
|
||||||
data := pow.prepareData(nonce)
|
data := pow.prepareData(nonce)
|
||||||
|
|
||||||
hash = sha256.Sum256(data)
|
hash = sha256.Sum256(data)
|
||||||
fmt.Printf("\r%x", hash)
|
if math.Remainder(float64(nonce), 100000) == 0 {
|
||||||
|
fmt.Printf("\r%x", hash)
|
||||||
|
}
|
||||||
hashInt.SetBytes(hash[:])
|
hashInt.SetBytes(hash[:])
|
||||||
|
|
||||||
if hashInt.Cmp(pow.target) == -1 {
|
if hashInt.Cmp(pow.target) == -1 {
|
||||||
|
|
Loading…
Reference in New Issue