From a07ed5876b5a0fc49ddc189a279cd52c0b919c33 Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Wed, 9 Nov 2016 07:29:45 +0900 Subject: [PATCH] Count missing UTXOs and log just once They're a temporary phenomenon but it's handy to see how often these things happen. Fixes #10. --- server/block_processor.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/server/block_processor.py b/server/block_processor.py index 52b5b7a..feb4eee 100644 --- a/server/block_processor.py +++ b/server/block_processor.py @@ -175,6 +175,8 @@ class MemPool(LoggedClass): ''' hex_hashes = set(hex_hashes) touched = set() + missing_utxos = 0 + initial = self.count < 0 if initial: self.logger.info('beginning import of {:,d} mempool txs' @@ -225,10 +227,8 @@ class MemPool(LoggedClass): return mempool_entry[1][txin.prev_idx], True entry = utxo_lookup(txin.prev_hash, txin.prev_idx) if entry == NO_CACHE_ENTRY: - # Not possible unless daemon is lying or we're corrupted? - self.logger.warning('no UTXO found for {} / {}' - .format(hash_to_str(txin.prev_hash), - txin.prev_idx)) + # This happens when the daemon is a block ahead of us + # and has mempool txs spending new txs in that block raise MissingUTXOError value, = struct.unpack('