|
| 1 | + |
1 | 2 | # Electrum - Lightweight Bitcoin Client |
2 | 3 | # Copyright (c) 2011-2016 Thomas Voegtlin |
3 | 4 | # |
|
35 | 36 | import traceback |
36 | 37 | from collections import defaultdict, deque |
37 | 38 | import threading |
38 | | - |
39 | 39 | import socket |
40 | 40 | import json |
41 | 41 |
|
|
47 | 47 | from . import blockchain |
48 | 48 | from .version import ELECTRUM_VERSION, PROTOCOL_VERSION |
49 | 49 |
|
50 | | -DEFAULT_PORTS = {'t':'50001', 's':'50002'} |
51 | | - |
52 | | -#There is a schedule to move the default list to e-x (electrumx) by Jan 2018 |
53 | | -#Schedule is as follows: |
54 | | -#move ~3/4 to e-x by 1.4.17 |
55 | | -#then gradually switch remaining nodes to e-x nodes |
56 | | - |
57 | | -DEFAULT_SERVERS = { |
58 | | - 'erbium1.sytes.net':DEFAULT_PORTS, # core, e-x |
59 | | - 'ecdsa.net':{'t':'50001', 's':'110'}, # core, e-x |
60 | | - 'gh05.geekhosters.com':DEFAULT_PORTS, # core, e-s |
61 | | - 'VPS.hsmiths.com':DEFAULT_PORTS, # core, e-x |
62 | | - 'electrum.anduck.net':DEFAULT_PORTS, # core, e-s; banner with version pending |
63 | | - 'electrum.no-ip.org':DEFAULT_PORTS, # core, e-s |
64 | | - 'electrum.be':DEFAULT_PORTS, # core, e-x |
65 | | - 'helicarrier.bauerj.eu':DEFAULT_PORTS, # core, e-x |
66 | | - 'elex01.blackpole.online':DEFAULT_PORTS, # core, e-x |
67 | | - 'electrumx.not.fyi':DEFAULT_PORTS, # core, e-x |
68 | | - 'node.xbt.eu':DEFAULT_PORTS, # core, e-x |
69 | | - 'kirsche.emzy.de':DEFAULT_PORTS, # core, e-x |
70 | | - 'electrum.villocq.com':DEFAULT_PORTS, # core?, e-s; banner with version recommended |
71 | | - 'us11.einfachmalnettsein.de':DEFAULT_PORTS, # core, e-x |
72 | | - 'electrum.trouth.net':DEFAULT_PORTS, # BU, e-s |
73 | | - 'Electrum.hsmiths.com':{'t':'8080', 's':'995'}, # core, e-x |
74 | | - 'electrum3.hachre.de':DEFAULT_PORTS, # core, e-x |
75 | | - 'b.1209k.com':DEFAULT_PORTS, # XT, jelectrum |
76 | | - 'elec.luggs.co':{ 's':'443'}, # core, e-x |
77 | | - 'btc.smsys.me':{'t':'110', 's':'995'}, # BU, e-x |
78 | | -} |
79 | | - |
80 | | -def set_testnet(): |
81 | | - global DEFAULT_PORTS, DEFAULT_SERVERS |
82 | | - DEFAULT_PORTS = {'t':'51001', 's':'51002'} |
83 | | - DEFAULT_SERVERS = { |
84 | | - 'testnetnode.arihanc.com': DEFAULT_PORTS, |
85 | | - 'testnet1.bauerj.eu': DEFAULT_PORTS, |
86 | | - '14.3.140.101': DEFAULT_PORTS, |
87 | | - 'testnet.hsmiths.com': {'t':'53011', 's':'53012'}, |
88 | | - 'electrum.akinbo.org': DEFAULT_PORTS, |
89 | | - 'ELEX05.blackpole.online': {'t':'52011', 's':'52002'}, |
90 | | - } |
91 | | - |
92 | | -def set_nolnet(): |
93 | | - global DEFAULT_PORTS, DEFAULT_SERVERS |
94 | | - DEFAULT_PORTS = {'t':'52001', 's':'52002'} |
95 | | - DEFAULT_SERVERS = { |
96 | | - '14.3.140.101': DEFAULT_PORTS, |
97 | | - } |
98 | 50 |
|
99 | 51 | NODES_RETRY_INTERVAL = 60 |
100 | 52 | SERVER_RETRY_INTERVAL = 10 |
@@ -401,11 +353,10 @@ def get_interfaces(self): |
401 | 353 | return list(self.interfaces.keys()) |
402 | 354 |
|
403 | 355 | def get_servers(self): |
| 356 | + out = DEFAULT_SERVERS |
404 | 357 | if self.irc_servers: |
405 | | - out = self.irc_servers.copy() |
406 | | - out.update(DEFAULT_SERVERS) |
| 358 | + out.update(filter_version(self.irc_servers.copy())) |
407 | 359 | else: |
408 | | - out = DEFAULT_SERVERS |
409 | 360 | for s in self.recent_servers: |
410 | 361 | try: |
411 | 362 | host, port, protocol = deserialize_server(s) |
@@ -510,7 +461,8 @@ def switch_to_random_interface(self): |
510 | 461 | '''Switch to a random connected server other than the current one''' |
511 | 462 | servers = self.get_interfaces() # Those in connected state |
512 | 463 | if self.default_server in servers: |
513 | | - servers.remove(self.default_server) |
| 464 | + servers.remov |
| 465 | + e(self.default_server) |
514 | 466 | if servers: |
515 | 467 | self.switch_to_interface(random.choice(servers)) |
516 | 468 |
|
@@ -577,7 +529,7 @@ def process_response(self, interface, response, callbacks): |
577 | 529 | self.on_notify_header(interface, result) |
578 | 530 | elif method == 'server.peers.subscribe': |
579 | 531 | if error is None: |
580 | | - self.irc_servers = filter_version(parse_servers(result)) |
| 532 | + self.irc_servers = parse_servers(result) |
581 | 533 | self.notify('servers') |
582 | 534 | elif method == 'server.banner': |
583 | 535 | if error is None: |
|
0 commit comments