This commit is contained in:
parent
024aceda53
commit
e60bb35ebd
2 changed files with 5 additions and 5 deletions
|
@ -82,6 +82,7 @@ class PrimaryDB(SecondaryDB):
|
||||||
prefix_db.unsafe_commit()
|
prefix_db.unsafe_commit()
|
||||||
self.logger.info(f"wrote {hashX_cnt}/{len(hashXs)} hashXs statuses...")
|
self.logger.info(f"wrote {hashX_cnt}/{len(hashXs)} hashXs statuses...")
|
||||||
self._index_address_status = True
|
self._index_address_status = True
|
||||||
|
self.last_indexed_address_status_height = self.db_height
|
||||||
self.write_db_state()
|
self.write_db_state()
|
||||||
self.prefix_db.unsafe_commit()
|
self.prefix_db.unsafe_commit()
|
||||||
self.logger.info("finished indexing address statuses")
|
self.logger.info("finished indexing address statuses")
|
||||||
|
@ -101,17 +102,13 @@ class PrimaryDB(SecondaryDB):
|
||||||
|
|
||||||
def write_db_state(self):
|
def write_db_state(self):
|
||||||
"""Write (UTXO) state to the batch."""
|
"""Write (UTXO) state to the batch."""
|
||||||
last_indexed_address_status = 0
|
|
||||||
if self.db_height > 0:
|
if self.db_height > 0:
|
||||||
existing = self.prefix_db.db_state.get()
|
existing = self.prefix_db.db_state.get()
|
||||||
last_indexed_address_status = existing.hashX_status_last_indexed_height
|
|
||||||
self.prefix_db.db_state.stage_delete((), existing.expanded)
|
self.prefix_db.db_state.stage_delete((), existing.expanded)
|
||||||
if self._index_address_status:
|
|
||||||
last_indexed_address_status = self.db_height
|
|
||||||
self.prefix_db.db_state.stage_put((), (
|
self.prefix_db.db_state.stage_put((), (
|
||||||
self.genesis_bytes, self.db_height, self.db_tx_count, self.db_tip,
|
self.genesis_bytes, self.db_height, self.db_tx_count, self.db_tip,
|
||||||
self.utxo_flush_count, int(self.wall_time), self.catching_up, self._index_address_status, self.db_version,
|
self.utxo_flush_count, int(self.wall_time), self.catching_up, self._index_address_status, self.db_version,
|
||||||
self.hist_flush_count, self.hist_comp_flush_count, self.hist_comp_cursor,
|
self.hist_flush_count, self.hist_comp_flush_count, self.hist_comp_cursor,
|
||||||
self.es_sync_height, last_indexed_address_status
|
self.es_sync_height, self.last_indexed_address_status_height
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
@ -1486,8 +1486,11 @@ class BlockchainProcessorService(BlockchainService):
|
||||||
# update hashX history status hashes and compactify the histories
|
# update hashX history status hashes and compactify the histories
|
||||||
self._get_update_hashX_histories_ops(height)
|
self._get_update_hashX_histories_ops(height)
|
||||||
|
|
||||||
|
# only compactify adddress histories and update the status index if we're already caught up,
|
||||||
|
# a bulk update will happen once catchup finishes
|
||||||
if not self.db.catching_up and self.env.index_address_status:
|
if not self.db.catching_up and self.env.index_address_status:
|
||||||
self._get_compactify_ops(height)
|
self._get_compactify_ops(height)
|
||||||
|
self.db.last_indexed_address_status_height = height
|
||||||
|
|
||||||
self.tx_count = tx_count
|
self.tx_count = tx_count
|
||||||
self.db.tx_counts.append(self.tx_count)
|
self.db.tx_counts.append(self.tx_count)
|
||||||
|
|
Loading…
Reference in a new issue