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:
Denis 2017-10-18 12:21:38 +03:00 committed by GitHub
parent cb32e7ca13
commit 989569ce61
1 changed files with 3 additions and 1 deletions

View File

@ -56,7 +56,9 @@ func (pow *ProofOfWork) Run() (int, []byte) {
data := pow.prepareData(nonce)
hash = sha256.Sum256(data)
fmt.Printf("\r%x", hash)
if math.Remainder(float64(nonce), 100000) == 0 {
fmt.Printf("\r%x", hash)
}
hashInt.SetBytes(hash[:])
if hashInt.Cmp(pow.target) == -1 {