1
0

Merge pull request #3257 from SomberNight/bitcoin_network_constants

bitcoin.NetworkConstants: easier changing between testnet and mainnet
This commit is contained in:
ThomasV
2017-11-10 09:15:40 +01:00
committed by GitHub
9 changed files with 55 additions and 57 deletions

View File

@@ -95,8 +95,8 @@ class ElectrumWindow(App):
from .uix.dialogs.choice_dialog import ChoiceDialog
protocol = 's'
def cb2(host):
from electrum.network import DEFAULT_PORTS
pp = servers.get(host, DEFAULT_PORTS)
from electrum.bitcoin import NetworkConstants
pp = servers.get(host, NetworkConstants.DEFAULT_PORTS)
port = pp.get(protocol, '')
popup.ids.host.text = host
popup.ids.port.text = port

View File

@@ -30,7 +30,7 @@ from PyQt5.QtCore import *
import PyQt5.QtCore as QtCore
from electrum.i18n import _
from electrum.network import DEFAULT_PORTS
from electrum.bitcoin import NetworkConstants
from electrum.network import serialize_server, deserialize_server
from electrum.util import print_error
@@ -397,7 +397,7 @@ class NetworkChoiceLayout(object):
def change_protocol(self, use_ssl):
p = 's' if use_ssl else 't'
host = self.server_host.text()
pp = self.servers.get(host, DEFAULT_PORTS)
pp = self.servers.get(host, NetworkConstants.DEFAULT_PORTS)
if p not in pp.keys():
p = list(pp.keys())[0]
port = pp[p]
@@ -422,7 +422,7 @@ class NetworkChoiceLayout(object):
self.change_server(str(x.text(0)), self.protocol)
def change_server(self, host, protocol):
pp = self.servers.get(host, DEFAULT_PORTS)
pp = self.servers.get(host, NetworkConstants.DEFAULT_PORTS)
if protocol and protocol not in protocol_letters:
protocol = None
if protocol: