in removeblock calculate size of block before removing it

master
Kevin Froman 2020-09-28 08:19:06 +00:00
parent 6370d07f90
commit ab9726a41a
1 changed files with 1 additions and 1 deletions

View File

@ -35,6 +35,7 @@ def remove_block(block):
**You may want blacklist.addToDB(blockHash)
"""
if stringvalidators.validate_hash(block):
dataSize = sys.getsizeof(onionrstorage.getData(block))
conn = sqlite3.connect(
dbfiles.block_meta_db, timeout=DATABASE_LOCK_TIMEOUT)
c = conn.cursor()
@ -42,7 +43,6 @@ def remove_block(block):
c.execute('Delete from hashes where hash=?;', t)
conn.commit()
conn.close()
dataSize = sys.getsizeof(onionrstorage.getData(block))
storage_counter.remove_bytes(dataSize)
else:
raise onionrexceptions.InvalidHexHash