From 34265eb29d7adc16b102091b4063afe22e8d0524 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Wed, 14 Nov 2012 16:13:09 +0400 Subject: [PATCH] fix a few bugs --- backends/bitcoind/blockchain_processor.py | 8 ++++---- processor.py | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/backends/bitcoind/blockchain_processor.py b/backends/bitcoind/blockchain_processor.py index 5a88bc3..1ad48f3 100644 --- a/backends/bitcoind/blockchain_processor.py +++ b/backends/bitcoind/blockchain_processor.py @@ -110,7 +110,7 @@ class BlockchainProcessor(Processor): def block2header(self, b): return {"block_height":b.get('height'), "version":b.get('version'), "prev_block_hash":b.get('previousblockhash'), - "merkle_root":b.get('merkleroot'), "timestamp":b.get('time'), "bits":b.get('bits'), "nonce":b.get('nonce')} + "merkle_root":b.get('merkleroot'), "timestamp":b.get('time'), "bits":int(b.get('bits'),16), "nonce":b.get('nonce')} def get_header(self, height): @@ -154,7 +154,7 @@ class BlockchainProcessor(Processor): for txid in self.mempool_hist.get(addr,[]): hist.append((txid, 0)) - hist = map(lambda x: {'tx_hash':x[0], 'height':x[1]}, hist) + hist = map(lambda x: {'tx_hash':x[0], 'height':x[2]}, hist) with self.cache_lock: self.history_cache[addr] = hist return hist @@ -372,13 +372,13 @@ class BlockchainProcessor(Processor): elif method == 'blockchain.address.subscribe2': try: address = params[0] - result = self.get_status2(address, cache_only) + result = self.get_status(address, cache_only) self.watch_address(address) except BaseException, e: error = str(e) + ': ' + address print_log( "error:", error ) - elif method == 'blockchain.address.get_history': + elif method == 'blockchain.address.get_history2': try: address = params[0] result = self.get_history( address, cache_only ) diff --git a/processor.py b/processor.py index e7a340c..9d1355d 100644 --- a/processor.py +++ b/processor.py @@ -183,9 +183,9 @@ class RequestDispatcher(threading.Thread): except: pass - if session.protocol_version < 0.6: - print_log("stopping session from old client") - session.stop() + if session.protocol_version < 0.6: + print_log("stopping session from old client", session.protocol_version) + session.stop() def get_sessions(self): with self.lock: -- 1.7.1