From e4ac106b982c4ad6a24af10b88ae73939d458516 Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Tue, 10 May 2022 18:49:53 -0400 Subject: [PATCH] _get_clear_mempool_ops --- scribe/blockchain/service.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/scribe/blockchain/service.py b/scribe/blockchain/service.py index 222e269..ee858c7 100644 --- a/scribe/blockchain/service.py +++ b/scribe/blockchain/service.py @@ -1395,9 +1395,8 @@ class BlockchainProcessorService(BlockchainService): 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( - start=(b'\x00' * 20, ), stop=(b'\xff' * 20, ), deserialize_key=False, deserialize_value=False): - self.db.prefix_db.stage_raw_delete(k, v) + # clear the mempool tx index + self._get_clear_mempool_ops() for hashX, new_history in self.hashXs_by_tx.items(): # TODO: combine this with compaction so that we only read the history once @@ -1450,6 +1449,12 @@ class BlockchainProcessorService(BlockchainService): # print("*************\n") 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): self.txo_to_claim.clear() self.claim_hash_to_txo.clear()