Merge pull request #4 from denispeplin/patch-1

Don't output every hash onto console, its too slow
This commit is contained in:
Ivan Kuznetsov 2017-10-28 20:59:36 +07:00 committed by GitHub
commit c5c21fd069
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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) 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 {