set dataSaved when it should have already been
parent
aaecd0adaf
commit
b4d61d3598
|
@ -166,18 +166,18 @@ class Core:
|
||||||
dataHash = dataHash.decode()
|
dataHash = dataHash.decode()
|
||||||
blockFileName = self.blockDataLocation + dataHash + '.dat'
|
blockFileName = self.blockDataLocation + dataHash + '.dat'
|
||||||
if os.path.exists(blockFileName):
|
if os.path.exists(blockFileName):
|
||||||
return # to do, properly check if block is already saved elsewhere
|
pass # to do, properly check if block is already saved elsewhere
|
||||||
raise Exception("Data is already set for " + dataHash)
|
#raise Exception("Data is already set for " + dataHash)
|
||||||
else:
|
else:
|
||||||
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)
|
conn = sqlite3.connect(self.blockDB)
|
||||||
c = conn.cursor()
|
c = conn.cursor()
|
||||||
c.execute("UPDATE hashes set dataSaved=1 where hash = '" + dataHash + "';")
|
c.execute("UPDATE hashes set dataSaved=1 where hash = '" + dataHash + "';")
|
||||||
conn.commit()
|
conn.commit()
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
return dataHash
|
return dataHash
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue