From e651530e5db0409b67bc98926ff57bd26a5f9372 Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Sun, 6 Nov 2016 09:57:11 +0900 Subject: [PATCH] Log immediately if mempool shrinks --- server/block_processor.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/server/block_processor.py b/server/block_processor.py index 3b8c0b4..0db296a 100644 --- a/server/block_processor.py +++ b/server/block_processor.py @@ -167,7 +167,7 @@ class MemPool(LoggedClass): self.txs = {} self.hash168s = defaultdict(set) # None can be a key self.bp = bp - self.count = 0 + self.count = -1 async def update(self, hex_hashes): '''Update state given the current mempool to the passed set of hashes. @@ -178,7 +178,7 @@ class MemPool(LoggedClass): hex_hashes = set(hex_hashes) touched = set() - if self.count == 0: + if self.count < 0: self.logger.info('initial fetch of {:,d} daemon mempool txs' .format(len(hex_hashes))) @@ -251,10 +251,11 @@ class MemPool(LoggedClass): self.hash168s[hash168].add(hex_hash) touched.add(hash168) - if self.count % 20 == 0: + self.count += 1 + if self.count % 25 == 0 or gone: + self.count = 0 self.logger.info('{:,d} txs touching {:,d} addresses' .format(len(self.txs), len(self.hash168s))) - self.count += 1 # Might include a None return touched