timprove 'peers' script - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 0bba8e454996dc2be287e48c7acfaf261ee08530 DIR parent 7ab4db0d232cd55da0076778c621a0dddfed036a HTML Author: thomasv <thomasv@gitorious> Date: Mon, 16 Dec 2013 16:26:49 +0100 improve 'peers' script Diffstat: M scripts/peers | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) --- DIR diff --git a/scripts/peers b/scripts/peers t@@ -3,10 +3,15 @@ import time, electrum electrum.set_verbosity(False) # default is True - network = electrum.Network({'verbose':False}) -network.start(wait=True) -time.sleep(1) -electrum.print_json( network.heights ) +network.register_callback('peers',lambda: electrum.print_json(network.irc_servers.keys())) + +if not network.start(wait=True): + print "Not connected [%s]"% network.interface.server + exit(1) + +print "Connected to", network.interface.server +while not network.irc_servers: + time.sleep(1)