now update block datasaved stat when saved
parent
7acb695acd
commit
dc65254e0a
|
@ -137,7 +137,10 @@ class OnionrCommunicate:
|
||||||
if data == False or len(data) > 10000000:
|
if data == False or len(data) > 10000000:
|
||||||
continue
|
continue
|
||||||
hasher.update(data.encode())
|
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)
|
self._core.setData(data)
|
||||||
logger.info('Successfully obtained data for ' + hash)
|
logger.info('Successfully obtained data for ' + hash)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -169,6 +169,13 @@ class Core:
|
||||||
blockFile = open(blockFileName, 'w')
|
blockFile = open(blockFileName, 'w')
|
||||||
blockFile.write(data.decode())
|
blockFile.write(data.decode())
|
||||||
blockFile.close()
|
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
|
return dataHash
|
||||||
|
|
||||||
def dataDirEncrypt(self, password):
|
def dataDirEncrypt(self, password):
|
||||||
|
|
Loading…
Reference in New Issue