fix catch_up

This commit is contained in:
Jack Robison 2022-03-16 21:57:41 -04:00
parent 28356b49dc
commit bd68613b74
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
2 changed files with 9 additions and 6 deletions

View file

@ -723,8 +723,8 @@ class HubDB:
return results return results
async def _read_tx_counts(self): async def _read_tx_counts(self):
if self.tx_counts is not None: # if self.tx_counts is not None:
return # return
# tx_counts[N] has the cumulative number of txs at the end of # tx_counts[N] has the cumulative number of txs at the end of
# height N. So tx_counts[0] is 1 - the genesis coinbase # 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)) self.logger.info("loaded %i claim txos in %ss", len(self.claim_to_txo), round(ts, 4))
async def _read_headers(self): async def _read_headers(self):
if self.headers is not None: # if self.headers is not None:
return # return
def get_headers(): def get_headers():
return [ return [

View file

@ -296,9 +296,12 @@ class ElasticWriter(BaseBlockchainReader):
last_state = self.db.prefix_db.db_state.get() last_state = self.db.prefix_db.db_state.get()
db_height = last_state.height db_height = last_state.height
if last_state and self._last_wrote_height and db_height > self._last_wrote_height: if last_state and self._last_wrote_height and db_height > self._last_wrote_height:
self.log.info( self.log.warning(
"syncing ES from block %i to rocksdb height of %i", self._last_wrote_height, last_state.height "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): for height in range(self._last_wrote_height + 1, last_state.height + 1):
self.advance(height) self.advance(height)
else: else: