From bd68613b747d8118529ed2db2adcb602e0764cea Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Wed, 16 Mar 2022 21:57:41 -0400 Subject: [PATCH] fix catch_up --- scribe/db/db.py | 8 ++++---- scribe/reader/elastic_sync.py | 7 +++++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/scribe/db/db.py b/scribe/db/db.py index 6323f79..a45814c 100644 --- a/scribe/db/db.py +++ b/scribe/db/db.py @@ -723,8 +723,8 @@ class HubDB: return results async def _read_tx_counts(self): - if self.tx_counts is not None: - return + # if self.tx_counts is not None: + # return # tx_counts[N] has the cumulative number of txs at the end of # height N. So tx_counts[0] is 1 - the genesis coinbase @@ -761,8 +761,8 @@ class HubDB: self.logger.info("loaded %i claim txos in %ss", len(self.claim_to_txo), round(ts, 4)) async def _read_headers(self): - if self.headers is not None: - return + # if self.headers is not None: + # return def get_headers(): return [ diff --git a/scribe/reader/elastic_sync.py b/scribe/reader/elastic_sync.py index 64017d9..ca56b49 100644 --- a/scribe/reader/elastic_sync.py +++ b/scribe/reader/elastic_sync.py @@ -296,9 +296,12 @@ class ElasticWriter(BaseBlockchainReader): last_state = self.db.prefix_db.db_state.get() db_height = last_state.height if last_state and self._last_wrote_height and db_height > self._last_wrote_height: - self.log.info( - "syncing ES from block %i to rocksdb height of %i", self._last_wrote_height, last_state.height + self.log.warning( + "syncing ES from block %i to rocksdb height of %i (%i blocks to sync)", + self._last_wrote_height, last_state.height, last_state.height - self._last_wrote_height ) + for _ in range(self._last_wrote_height + 1, last_state.height + 1): + super().unwind() for height in range(self._last_wrote_height + 1, last_state.height + 1): self.advance(height) else: