From 1a781036cf0a3d04c5e170ef71fbf3e36c2ab908 Mon Sep 17 00:00:00 2001 From: thomasv Date: Fri, 12 Oct 2012 16:09:20 +0200 Subject: [PATCH] move init_socket in constructor --- lib/interface.py | 4 +--- scripts/blocks | 6 +++--- scripts/get_history | 1 - scripts/merchant.py | 1 - scripts/peers | 1 - scripts/watch_address | 1 - 6 files changed, 4 insertions(+), 10 deletions(-) diff --git a/lib/interface.py b/lib/interface.py index 1f64278b..ddb6a0c3 100644 --- a/lib/interface.py +++ b/lib/interface.py @@ -60,8 +60,6 @@ class InterfaceAncestor(threading.Thread): self.responses = Queue.Queue() self.unanswered_requests = {} - def init_socket(self): - pass def poke(self): # push a fake response so that the getting thread exits its loop @@ -210,6 +208,7 @@ class TcpStratumInterface(InterfaceAncestor): def __init__(self, host, port, proxy=None): InterfaceAncestor.__init__(self, host, port, proxy) + self.init_socket() def init_socket(self): global proxy_modes @@ -435,7 +434,6 @@ class WalletSynchronizer(threading.Thread): def start_interface(self): - self.interface.init_socket() self.interface.start() if self.interface.is_connected: self.wallet.start_session(self.interface) diff --git a/scripts/blocks b/scripts/blocks index dfa89198..8f7500d5 100755 --- a/scripts/blocks +++ b/scripts/blocks @@ -1,9 +1,9 @@ #!/usr/bin/env python -from electrum import Interface +import electrum + +i = electrum.Interface({'server':'electrum.novit.ro:50001:t'}) -i = Interface({'server':'electrum.novit.ro:50001:t'}) -i.init_socket() i.start() i.send([('blockchain.numblocks.subscribe',[])]) diff --git a/scripts/get_history b/scripts/get_history index 0a8ca088..c6800985 100755 --- a/scripts/get_history +++ b/scripts/get_history @@ -10,7 +10,6 @@ except: sys.exit(1) i = Interface({'server':'electrum.novit.ro:50001:t'}) -i.init_socket() i.start() i.send([('blockchain.address.get_history',[addr])]) diff --git a/scripts/merchant.py b/scripts/merchant.py index 409ea567..7334abf1 100644 --- a/scripts/merchant.py +++ b/scripts/merchant.py @@ -158,7 +158,6 @@ if __name__ == '__main__': conn = mdb.connect(db_instance, db_user, db_password, db_name); i = Interface({'server':"%s:%d:t"%(electrum_server, 50001)}) - i.init_socket() i.start() diff --git a/scripts/peers b/scripts/peers index c3cb02e6..b3656efb 100755 --- a/scripts/peers +++ b/scripts/peers @@ -3,7 +3,6 @@ from electrum import Interface i = Interface({'server':'electrum.novit.ro:50001:t'}) -i.init_socket() i.start() i.send([('server.peers.subscribe',[])]) diff --git a/scripts/watch_address b/scripts/watch_address index a8763c7f..7c21ee9b 100755 --- a/scripts/watch_address +++ b/scripts/watch_address @@ -10,7 +10,6 @@ except: sys.exit(1) i = Interface({'server':'electrum.novit.ro:50001:t'}) -i.init_socket() i.start() i.send([('blockchain.address.subscribe',[addr])])