Merge pull request #2868 from SomberNight/testnet_hotfix

fix testnet
This commit is contained in:
ThomasV 2017-09-14 05:18:58 +02:00 committed by GitHub
commit 8da36e3bd1
3 changed files with 11 additions and 12 deletions

View File

@ -80,7 +80,7 @@ def set_testnet():
global TESTNET, HEADERS_URL global TESTNET, HEADERS_URL
global GENESIS global GENESIS
global SEGWIT_HRP global SEGWIT_HRP
global DEFAULT_PORTS, SERVERLIST global DEFAULT_PORTS, SERVERLIST, DEFAULT_SERVERS
TESTNET = True TESTNET = True
ADDRTYPE_P2PKH = 111 ADDRTYPE_P2PKH = 111
ADDRTYPE_P2SH = 196 ADDRTYPE_P2SH = 196

View File

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

View File

@ -1,8 +1,8 @@
{ {
'testnetnode.arihanc.com': {'t':'51001', 's':'51002'}, "testnetnode.arihanc.com": {"t":"51001", "s":"51002"},
'testnet1.bauerj.eu': {'t':'51001', 's':'51002'}, "testnet1.bauerj.eu": {"t":"51001", "s":"51002"},
'14.3.140.101': {'t':'51001', 's':'51002'}, "14.3.140.101": {"t":"51001", "s":"51002"},
'testnet.hsmiths.com': {'t':'53011', 's':'53012'}, "testnet.hsmiths.com": {"t":"53011", "s":"53012"},
'electrum.akinbo.org': {'t':'51001', 's':'51002'}, "electrum.akinbo.org": {"t":"51001", "s":"51002"},
'ELEX05.blackpole.online': {'t':'52011', 's':'52002'}, "ELEX05.blackpole.online": {"t":"52011", "s":"52002"}
} }