add init_socket to scripts
authorThomasV <thomasv@gitorious>
Thu, 17 May 2012 18:26:37 +0000 (20:26 +0200)
committerThomasV <thomasv@gitorious>
Thu, 17 May 2012 18:26:37 +0000 (20:26 +0200)
blocks
watch_address

diff --git a/blocks b/blocks
index cf03340..5491d2c 100755 (executable)
--- a/blocks
+++ b/blocks
@@ -3,9 +3,11 @@
 from electrum import TcpStratumInterface
 
 i = TcpStratumInterface('ecdsa.org', 50001)
+i.init_socket()
 i.start()
 i.send([('blockchain.numblocks.subscribe',[])])
 
 while True:
     r = i.responses.get(True, 100000000000)
-    print r.get('result')
+    if r.get('method') == 'blockchain.numblocks.subscribe':
+        print r.get('result')
index 41d2051..698d9b4 100755 (executable)
@@ -9,6 +9,7 @@ except:
     print "usage: watch_address <bitcoin_address>"
 
 i = TcpStratumInterface('ecdsa.org', 50001)
+i.init_socket()
 i.start()
 i.send([('blockchain.address.subscribe',[addr])])