Merge pull request #4008 from SomberNight/network_constants_refactor
refactor network constants
This commit is contained in:
@@ -99,8 +99,8 @@ class ElectrumWindow(App):
|
||||
from .uix.dialogs.choice_dialog import ChoiceDialog
|
||||
protocol = 's'
|
||||
def cb2(host):
|
||||
from electrum.bitcoin import NetworkConstants
|
||||
pp = servers.get(host, NetworkConstants.DEFAULT_PORTS)
|
||||
from electrum import constants
|
||||
pp = servers.get(host, constants.net.DEFAULT_PORTS)
|
||||
port = pp.get(protocol, '')
|
||||
popup.ids.host.text = host
|
||||
popup.ids.port.text = port
|
||||
|
||||
@@ -36,7 +36,7 @@ from PyQt5.QtGui import QIcon
|
||||
from PyQt5.QtWidgets import *
|
||||
|
||||
from electrum.i18n import _
|
||||
from electrum import ELECTRUM_VERSION, bitcoin
|
||||
from electrum import ELECTRUM_VERSION, bitcoin, constants
|
||||
|
||||
issue_template = """<h2>Traceback</h2>
|
||||
<pre>
|
||||
@@ -107,7 +107,7 @@ class Exception_Window(QWidget):
|
||||
self.show()
|
||||
|
||||
def send_report(self):
|
||||
if bitcoin.NetworkConstants.GENESIS[-4:] not in ["4943", "e26f"] and ".electrum.org" in report_server:
|
||||
if constants.net.GENESIS[-4:] not in ["4943", "e26f"] and ".electrum.org" in report_server:
|
||||
# Gah! Some kind of altcoin wants to send us crash reports.
|
||||
self.main_window.show_critical(_("Please report this issue manually."))
|
||||
return
|
||||
|
||||
@@ -40,7 +40,8 @@ from .exception_window import Exception_Hook
|
||||
from PyQt5.QtWidgets import *
|
||||
|
||||
from electrum import keystore, simple_config
|
||||
from electrum.bitcoin import COIN, is_address, TYPE_ADDRESS, NetworkConstants
|
||||
from electrum.bitcoin import COIN, is_address, TYPE_ADDRESS
|
||||
from electrum import constants
|
||||
from electrum.plugins import run_hook
|
||||
from electrum.i18n import _
|
||||
from electrum.util import (format_time, format_satoshis, PrintError,
|
||||
@@ -371,7 +372,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
||||
self.setGeometry(100, 100, 840, 400)
|
||||
|
||||
def watching_only_changed(self):
|
||||
name = "Electrum Testnet" if NetworkConstants.TESTNET else "Electrum"
|
||||
name = "Electrum Testnet" if constants.net.TESTNET else "Electrum"
|
||||
title = '%s %s - %s' % (name, self.wallet.electrum_version,
|
||||
self.wallet.basename())
|
||||
extra = [self.wallet.storage.get('wallet_type', '?')]
|
||||
|
||||
@@ -31,7 +31,7 @@ from PyQt5.QtWidgets import *
|
||||
import PyQt5.QtCore as QtCore
|
||||
|
||||
from electrum.i18n import _
|
||||
from electrum.bitcoin import NetworkConstants
|
||||
from electrum import constants
|
||||
from electrum.util import print_error
|
||||
from electrum.network import serialize_server, deserialize_server
|
||||
|
||||
@@ -393,7 +393,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, NetworkConstants.DEFAULT_PORTS)
|
||||
pp = self.servers.get(host, constants.net.DEFAULT_PORTS)
|
||||
if p not in pp.keys():
|
||||
p = list(pp.keys())[0]
|
||||
port = pp[p]
|
||||
@@ -418,7 +418,7 @@ class NetworkChoiceLayout(object):
|
||||
self.change_server(str(x.text(0)), self.protocol)
|
||||
|
||||
def change_server(self, host, protocol):
|
||||
pp = self.servers.get(host, NetworkConstants.DEFAULT_PORTS)
|
||||
pp = self.servers.get(host, constants.net.DEFAULT_PORTS)
|
||||
if protocol and protocol not in protocol_letters:
|
||||
protocol = None
|
||||
if protocol:
|
||||
|
||||
Reference in New Issue
Block a user