fix testnet
This commit is contained in:
@@ -65,7 +65,7 @@ def parse_servers(result):
|
||||
for v in item[2]:
|
||||
if re.match("[st]\d*", v):
|
||||
protocol, port = v[0], v[1:]
|
||||
if port == '': port = DEFAULT_PORTS[protocol]
|
||||
if port == '': port = bitcoin.DEFAULT_PORTS[protocol]
|
||||
out[protocol] = port
|
||||
elif re.match("v(.?)+", v):
|
||||
version = v[1:]
|
||||
@@ -99,7 +99,7 @@ def filter_protocol(hostmap, protocol = 's'):
|
||||
|
||||
def pick_random_server(hostmap = None, protocol = 's', exclude_set = set()):
|
||||
if hostmap is None:
|
||||
hostmap = DEFAULT_SERVERS
|
||||
hostmap = bitcoin.DEFAULT_SERVERS
|
||||
eligible = list(set(filter_protocol(hostmap, protocol)) - exclude_set)
|
||||
return random.choice(eligible) if eligible else None
|
||||
|
||||
@@ -354,7 +354,7 @@ class Network(util.DaemonThread):
|
||||
return list(self.interfaces.keys())
|
||||
|
||||
def get_servers(self):
|
||||
out = DEFAULT_SERVERS
|
||||
out = bitcoin.DEFAULT_SERVERS
|
||||
if self.irc_servers:
|
||||
out.update(filter_version(self.irc_servers.copy()))
|
||||
else:
|
||||
@@ -462,8 +462,7 @@ class Network(util.DaemonThread):
|
||||
'''Switch to a random connected server other than the current one'''
|
||||
servers = self.get_interfaces() # Those in connected state
|
||||
if self.default_server in servers:
|
||||
servers.remov
|
||||
e(self.default_server)
|
||||
servers.remove(self.default_server)
|
||||
if servers:
|
||||
self.switch_to_interface(random.choice(servers))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user