refactoring core databases to not use core anymore

This commit is contained in:
Kevin Froman 2019-07-17 11:58:40 -05:00
parent 000538ddc8
commit bf8a9c4f27
9 changed files with 39 additions and 52 deletions

View file

@ -82,7 +82,7 @@ def download_blocks_from_communicator(comm_inst):
logger.error('Reached disk allocation allowance, cannot save block %s.' % (blockHash,))
removeFromQueue = False
else:
comm_inst._core.addToBlockDB(blockHash, dataSaved=True)
blockmetadb.add_to_block_DB(blockHash, dataSaved=True) # add block to meta db
blockmetadata.process_block_metadata(comm_inst._core, blockHash) # caches block metadata values to block database
else:
logger.warn('POW failed for block %s.' % (blockHash,))

View file

@ -26,7 +26,7 @@ def clean_old_blocks(comm_inst):
'''Delete old blocks if our disk allocation is full/near full, and also expired blocks'''
# Delete expired blocks
for bHash in comm_inst._core.getExpiredBlocks():
for bHash in blockmetadb.get_expired_blocks():
comm_inst._core._blacklist.addToDB(bHash)
comm_inst._core.removeBlock(bHash)
logger.info('Deleted block: %s' % (bHash,))