Onionr/onionr/coredb/blockmetadb/expiredblocks.py
Kevin Froman 50e93f46e4 * Major core refactoring
* renamed clandestine to esoteric
2019-06-22 16:16:12 -05:00

15 lines
445 B
Python

import sqlite3
def get_expired_blocks(core_inst):
'''Returns a list of expired blocks'''
conn = sqlite3.connect(core_inst.blockDB, timeout=30)
c = conn.cursor()
date = int(core_inst._utils.getEpoch())
execute = 'SELECT hash FROM hashes WHERE expire <= %s ORDER BY dateReceived;' % (date,)
rows = list()
for row in c.execute(execute):
for i in row:
rows.append(i)
conn.close()
return rows