added processBlocks function

This commit is contained in:
Kevin Froman 2018-01-25 16:39:09 -06:00
parent 3f3a29439e
commit 67a84e2a19
3 changed files with 31 additions and 8 deletions

View file

@ -134,7 +134,18 @@ class Core:
def setData(self, data):
'''set the data assciated with a hash'''
hasher = hashlib.sha3_256
data = data.encode()
hasher = hashlib.sha3_256()
hasher.update(data)
dataHash = hasher.hexdigest()
blockFileName = self.blockDataLocation + dataHash + '.dat'
if os.path.exists(blockFileName):
raise Exception("Data is already set for " + dataHash)
else:
blockFile = open(blockFileName, 'w')
blockFile.write(data)
blockFile.close()
return dataHash
def dataDirEncrypt(self, password):
'''
@ -216,4 +227,11 @@ class Core:
generate and return an HMAC key
'''
key = base64.b64encode(os.urandom(32))
return key
return key
def processBlocks(self):
'''
Work with the block database and download any missing blocks
This is meant to be called from the communicator daemon on its timer.
'''
return