delete expired blocks

This commit is contained in:
Kevin Froman 2018-09-29 23:42:31 -05:00
parent 761dc9eb95
commit b344c53563
No known key found for this signature in database
GPG key ID: 0D414D0FE405B63B
4 changed files with 34 additions and 7 deletions

View file

@ -65,12 +65,17 @@ class DaemonTools:
self.daemon.decrementThreadCount('netCheck')
def cleanOldBlocks(self):
'''Delete old blocks if our disk allocation is full/near full'''
'''Delete old blocks if our disk allocation is full/near full, and also expired blocks'''
while self.daemon._core._utils.storageCounter.isFull():
oldest = self.daemon._core.getBlockList()[0]
self.daemon._core._blacklist.addToDB(oldest)
self.daemon._core.removeBlock(oldest)
logger.info('Deleted block: %s' % (oldest,))
logger.info('Deleted block: %s' % (oldest,))
# Delete expired blocks
for bHash in self.daemon._core.getExpiredBlocks():
self.daemon._core._blacklist.addToDB(bHash)
self.daemon._core.removeBlock(bHash)
self.daemon.decrementThreadCount('cleanOldBlocks')
def cooldownPeer(self):