in removeblock calculate size of block before removing it
This commit is contained in:
parent
6370d07f90
commit
ab9726a41a
@ -35,6 +35,7 @@ def remove_block(block):
|
|||||||
**You may want blacklist.addToDB(blockHash)
|
**You may want blacklist.addToDB(blockHash)
|
||||||
"""
|
"""
|
||||||
if stringvalidators.validate_hash(block):
|
if stringvalidators.validate_hash(block):
|
||||||
|
dataSize = sys.getsizeof(onionrstorage.getData(block))
|
||||||
conn = sqlite3.connect(
|
conn = sqlite3.connect(
|
||||||
dbfiles.block_meta_db, timeout=DATABASE_LOCK_TIMEOUT)
|
dbfiles.block_meta_db, timeout=DATABASE_LOCK_TIMEOUT)
|
||||||
c = conn.cursor()
|
c = conn.cursor()
|
||||||
@ -42,7 +43,6 @@ def remove_block(block):
|
|||||||
c.execute('Delete from hashes where hash=?;', t)
|
c.execute('Delete from hashes where hash=?;', t)
|
||||||
conn.commit()
|
conn.commit()
|
||||||
conn.close()
|
conn.close()
|
||||||
dataSize = sys.getsizeof(onionrstorage.getData(block))
|
|
||||||
storage_counter.remove_bytes(dataSize)
|
storage_counter.remove_bytes(dataSize)
|
||||||
else:
|
else:
|
||||||
raise onionrexceptions.InvalidHexHash
|
raise onionrexceptions.InvalidHexHash
|
||||||
|
Loading…
Reference in New Issue
Block a user