2019-06-22 21:16:12 +00:00
|
|
|
import sqlite3
|
2019-06-25 23:07:35 +00:00
|
|
|
from onionrutils import epoch
|
2019-06-22 21:16:12 +00:00
|
|
|
def get_expired_blocks(core_inst):
|
|
|
|
'''Returns a list of expired blocks'''
|
|
|
|
conn = sqlite3.connect(core_inst.blockDB, timeout=30)
|
|
|
|
c = conn.cursor()
|
2019-06-25 23:07:35 +00:00
|
|
|
date = int(epoch.get_epoch())
|
2019-06-22 21:16:12 +00:00
|
|
|
|
|
|
|
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
|