terminate if bitcoind is dead
authorThomasV <thomasv@gitorious>
Sun, 2 Dec 2012 06:57:19 +0000 (10:57 +0400)
committerThomasV <thomasv@gitorious>
Sun, 2 Dec 2012 06:57:19 +0000 (10:57 +0400)
backends/bitcoind/blockchain_processor.py

index 83c79ac..9620401 100644 (file)
@@ -81,7 +81,12 @@ class BlockchainProcessor(Processor):
 
     def bitcoind(self, method, params=[]):
         postdata = dumps({"method": method, 'params': params, 'id':'jsonrpc'})
-        respdata = urllib.urlopen(self.bitcoind_url, postdata).read()
+        try:
+            respdata = urllib.urlopen(self.bitcoind_url, postdata).read()
+        except:
+            traceback.print_exc(file=sys.stdout)
+            self.shared.stop()
+
         r = loads(respdata)
         if r['error'] != None:
             raise BaseException(r['error'])