Browse Source

fix testnet

seed_v14
SomberNight 7 years ago
parent
commit
efd07f727a
  1. 2
      lib/bitcoin.py
  2. 9
      lib/network.py
  3. 12
      lib/servers_testnet.json

2
lib/bitcoin.py

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

9
lib/network.py

@ -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))

12
lib/servers_testnet.json

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

Loading…
Cancel
Save