From 989569ce612ff7dc3aa8ea2f68e09efa9f1a8ed1 Mon Sep 17 00:00:00 2001 From: Denis Date: Wed, 18 Oct 2017 12:21:38 +0300 Subject: [PATCH] Don't output every hash onto console, its too slow Mining is about 3 times faster in average on my computer with this patch. --- proofofwork.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/proofofwork.go b/proofofwork.go index 967a4bc..cc10c1d 100644 --- a/proofofwork.go +++ b/proofofwork.go @@ -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 {