work on proof of work

This commit is contained in:
Kevin Froman 2018-05-05 18:32:10 -05:00
parent 1f8eb925c6
commit 9c3416e707
No known key found for this signature in database
GPG key ID: 0D414D0FE405B63B
3 changed files with 20 additions and 4 deletions

View file

@ -19,7 +19,7 @@
'''
import nacl.encoding, nacl.hash, nacl.utils, time, math, threading, binascii, logger, sys
import btc
import btc, core
class POW:
def pow(self, reporting = False):
@ -34,6 +34,7 @@ class POW:
blockCheckCount = 0
block = '' #self.bitcoinNode.getBlockHash(self.bitcoinNode.getLastBlockHeight())
#logger.debug('thread started')
myCore = core.Core()
while self.hashing:
'''
if blockCheckCount == blockCheck:
@ -45,7 +46,7 @@ class POW:
hbCount += 1
'''
rand = nacl.utils.random()
token = nacl.hash.blake2b(nacl.utils.random() + self.data).decode()
token = nacl.hash.blake2b(rand + self.data).decode()
#print(token)
if self.puzzle == token[0:self.difficulty]:
self.hashing = False