Expose --index_address_statuses setting and improve first sync performance #35

Merged
jackrobison merged 15 commits from optional-address-history-status into master 2022-05-18 02:14:59 +02:00
Showing only changes of commit e4ac106b98 - Show all commits

View file

@ -1395,9 +1395,8 @@ class BlockchainProcessorService(BlockchainService):
self.db.prefix_db.tx_count.stage_put(key_args=(height,), value_args=(tx_count,)) self.db.prefix_db.tx_count.stage_put(key_args=(height,), value_args=(tx_count,))
for k, v in self.db.prefix_db.hashX_mempool_status.iterate( # clear the mempool tx index
start=(b'\x00' * 20, ), stop=(b'\xff' * 20, ), deserialize_key=False, deserialize_value=False): self._get_clear_mempool_ops()
self.db.prefix_db.stage_raw_delete(k, v)
for hashX, new_history in self.hashXs_by_tx.items(): for hashX, new_history in self.hashXs_by_tx.items():
# TODO: combine this with compaction so that we only read the history once # TODO: combine this with compaction so that we only read the history once
@ -1450,6 +1449,12 @@ class BlockchainProcessorService(BlockchainService):
# print("*************\n") # print("*************\n")
return txo_count return txo_count
def _get_clear_mempool_ops(self):
self.db.prefix_db.multi_delete(
list(self.db.prefix_db.hashX_mempool_status.iterate(start=(b'\x00' * 20, ), stop=(b'\xff' * 20, ),
deserialize_key=False, deserialize_value=False))
)
def clear_after_advance_or_reorg(self): def clear_after_advance_or_reorg(self):
self.txo_to_claim.clear() self.txo_to_claim.clear()
self.claim_hash_to_txo.clear() self.claim_hash_to_txo.clear()