run migration on history db open

This commit is contained in:
Victor Shyba 2021-07-05 15:57:24 -03:00
parent 919c09fcb0
commit c2184fb3bf

View file

@ -58,6 +58,8 @@ class History:
def open_db(self, db_class, for_sync, utxo_flush_count, compacting): def open_db(self, db_class, for_sync, utxo_flush_count, compacting):
self.db = db_class('hist', for_sync) self.db = db_class('hist', for_sync)
self.read_state() self.read_state()
if self.needs_migration:
self.migrate()
self.clear_excess(utxo_flush_count) self.clear_excess(utxo_flush_count)
# An incomplete compaction needs to be cancelled otherwise # An incomplete compaction needs to be cancelled otherwise
# restarting it will corrupt the history # restarting it will corrupt the history