now update block datasaved stat when saved

master
Kevin Froman 2018-01-28 20:02:16 -06:00
parent 7acb695acd
commit dc65254e0a
No known key found for this signature in database
GPG Key ID: 0D414D0FE405B63B
2 changed files with 11 additions and 1 deletions

View File

@ -137,7 +137,10 @@ class OnionrCommunicate:
if data == False or len(data) > 10000000:
continue
hasher.update(data.encode())
if hasher.hexdigest() == hash.strip():
digest = hasher.hexdigest()
if digest is bytes:
digest = digest.decode()
if digest == hash.strip():
self._core.setData(data)
logger.info('Successfully obtained data for ' + hash)
else:

View File

@ -169,6 +169,13 @@ class Core:
blockFile = open(blockFileName, 'w')
blockFile.write(data.decode())
blockFile.close()
conn = sqlite3.connect(self.blockDB)
c = conn.cursor()
c.execute("UPDATE hashes set dataSaved=1 where id = '" + dataHash + "';")
conn.commit()
conn.close()
return dataHash
def dataDirEncrypt(self, password):