keep touched_or_deleted records

This commit is contained in:
Jack Robison 2021-11-21 13:52:03 -05:00 committed by Victor Shyba
parent bf86e7658e
commit b4d47e423d
2 changed files with 7 additions and 5 deletions

View file

@ -1524,10 +1524,11 @@ class BlockProcessor:
self.db.tx_counts.append(self.tx_count)
cached_max_reorg_depth = self.daemon.cached_height() - self.env.reorg_limit
if height >= cached_max_reorg_depth:
self.db.prefix_db.touched_or_deleted.stage_put(
key_args=(height,), value_args=(self.touched_claim_hashes, self.removed_claim_hashes)
)
# if height >= cached_max_reorg_depth:
self.db.prefix_db.touched_or_deleted.stage_put(
key_args=(height,), value_args=(self.touched_claim_hashes, self.removed_claim_hashes)
)
self.height = height
self.db.headers.append(block.header)
@ -1556,7 +1557,6 @@ class BlockProcessor:
now = time.time()
self.db.wall_time += now - self.db.last_flush
self.db.last_flush = now
self.db.write_db_state()
def clear_after_advance_or_reorg(self):

View file

@ -11,6 +11,7 @@ from lbry.wallet.server.db.elasticsearch.constants import ALL_FIELDS
async def get_recent_claims(env, index_name='claims', db=None):
log = logging.getLogger()
need_open = db is None
db = db or LevelDB(env)
try:
@ -20,6 +21,7 @@ async def get_recent_claims(env, index_name='claims', db=None):
return
if need_open:
await db.initialize_caches()
log.info(f"catching up ES ({db.es_sync_height}) to leveldb height: {db.db_height}")
cnt = 0
touched_claims = set()
deleted_claims = set()