From 2e55911cce2c45dcb88aa24331177223fdcd6ab4 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Thu, 15 Nov 2012 15:15:10 +0400 Subject: [PATCH] fix mempool and notifications --- backends/bitcoind/blockchain_processor.py | 25 ++++++++++++++++--------- 1 files changed, 16 insertions(+), 9 deletions(-) diff --git a/backends/bitcoind/blockchain_processor.py b/backends/bitcoind/blockchain_processor.py index 65af698..2bea34d 100644 --- a/backends/bitcoind/blockchain_processor.py +++ b/backends/bitcoind/blockchain_processor.py @@ -669,16 +669,20 @@ class BlockchainProcessor(Processor): self.mempool_addresses.pop(tx_hash) # rebuild histories - with self.mempool_lock: - self.mempool_hist = {} - for tx_hash, addresses in self.mempool_addresses.items(): - for addr in addresses: - h = self.mempool_hist.get(addr, []) - if tx_hash not in h: - h.append( tx_hash ) - self.mempool_hist[addr] = h - self.invalidate_cache(addr) + new_mempool_hist = {} + for tx_hash, addresses in self.mempool_addresses.items(): + for addr in addresses: + h = new_mempool_hist.get(addr, []) + if tx_hash not in h: + h.append( tx_hash ) + new_mempool_hist[addr] = h + for addr in self.mempool_hist.keys(): + if self.mempool_hist[addr] != new_mempool_hist[addr]: + self.invalidate_cache(addr) + + with self.mempool_lock: + self.mempool_hist = new_mempool_hist @@ -688,6 +692,8 @@ class BlockchainProcessor(Processor): print_log( "cache: invalidating", address ) self.history_cache.pop(address) + self.address_queue.put(address) + def main_iteration(self): @@ -723,6 +729,7 @@ class BlockchainProcessor(Processor): if addr in self.watched_addresses: status = self.get_status( addr ) self.push_response({ 'id': None, 'method':'blockchain.address.subscribe', 'params':[addr, status] }) + self.push_response({ 'id': None, 'method':'blockchain.address.subscribe2', 'params':[addr, status] }) if not self.shared.stopped(): -- 1.7.1