Require Python 3.5.3

3.5.2 has various socket and API issues affecting peer discovery

Closes #135
This commit is contained in:
Neil Booth 2017-03-01 06:49:36 +09:00
parent be9d063457
commit 39bcdb1b6a
8 changed files with 14 additions and 14 deletions

View File

@ -8,7 +8,7 @@ ElectrumX - Reimplementation of electrum-server
=============================================== ===============================================
:Licence: MIT :Licence: MIT
:Language: Python (>= 3.5.1) :Language: Python (>= 3.5.3)
:Author: Neil Booth :Author: Neil Booth
Getting Started Getting Started

View File

@ -252,9 +252,7 @@ some of this.
* **TOR_PROXY_HOST** * **TOR_PROXY_HOST**
The host where your Tor proxy is running. Defaults to *127.0.0.1*. The host where your Tor proxy is running. Defaults to *localhost*.
If you use a hostname here rather than an IP address, you must have
Python version >= 3.5.3, Python 3.5.2 will **not** work.
If you are not running a Tor proxy just leave this environment If you are not running a Tor proxy just leave this environment
variable undefined. variable undefined.

View File

@ -10,7 +10,8 @@ small - pull requests are welcome.
================ ======================== ================ ========================
Package Notes Package Notes
================ ======================== ================ ========================
Python3 ElectrumX uses asyncio. Python version >= 3.5 is **required**. Python3 ElectrumX uses asyncio. Python version >= 3.5.3 is
**required**.
`aiohttp`_ Python library for asynchronous HTTP. Version >= `aiohttp`_ Python library for asynchronous HTTP. Version >=
1.0 required; I am using 1.0.5. 1.0 required; I am using 1.0.5.
`pylru`_ Python LRU cache package. I'm using 1.0.9. `pylru`_ Python LRU cache package. I'm using 1.0.9.

View File

@ -13,6 +13,7 @@ import asyncio
import logging import logging
import os import os
import signal import signal
import sys
import traceback import traceback
from functools import partial from functools import partial
@ -28,9 +29,12 @@ SUPPRESS_MESSAGES = [
def main_loop(): def main_loop():
'''Start the server.''' '''Start the server.'''
if sys.version_info < (3, 5, 3):
raise RuntimeError('Python >= 3.5.3 is required to run ElectrumX')
if os.geteuid() == 0: if os.geteuid() == 0:
raise Exception('DO NOT RUN AS ROOT! Create an unpriveleged user ' raise RuntimeError('DO NOT RUN AS ROOT! Create an unpriveleged user '
'account and use that') 'account and use that')
loop = asyncio.get_event_loop() loop = asyncio.get_event_loop()
# loop.set_debug(True) # loop.set_debug(True)

View File

@ -289,8 +289,7 @@ class Controller(util.LoggedClass):
if env.tcp_port is not None: if env.tcp_port is not None:
await self.start_server('TCP', env.host, env.tcp_port) await self.start_server('TCP', env.host, env.tcp_port)
if env.ssl_port is not None: if env.ssl_port is not None:
# Python 3.5.3: use PROTOCOL_TLS sslc = ssl.SSLContext(ssl.PROTOCOL_TLS)
sslc = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
sslc.load_cert_chain(env.ssl_certfile, keyfile=env.ssl_keyfile) sslc.load_cert_chain(env.ssl_certfile, keyfile=env.ssl_keyfile)
await self.start_server('SSL', env.host, env.ssl_port, ssl=sslc) await self.start_server('SSL', env.host, env.ssl_port, ssl=sslc)

View File

@ -51,8 +51,7 @@ class Env(LoggedClass):
# Peer discovery # Peer discovery
self.peer_discovery = bool(self.default('PEER_DISCOVERY', True)) self.peer_discovery = bool(self.default('PEER_DISCOVERY', True))
self.peer_announce = bool(self.default('PEER_ANNOUNCE', True)) self.peer_announce = bool(self.default('PEER_ANNOUNCE', True))
# Python 3.5.3 - revert back to localhost? self.tor_proxy_host = self.default('TOR_PROXY_HOST', 'localhost')
self.tor_proxy_host = self.default('TOR_PROXY_HOST', '127.0.0.1')
self.tor_proxy_port = self.integer('TOR_PROXY_PORT', None) self.tor_proxy_port = self.integer('TOR_PROXY_PORT', None)
# The electrum client takes the empty string as unspecified # The electrum client takes the empty string as unspecified
self.donation_address = self.default('DONATION_ADDRESS', '') self.donation_address = self.default('DONATION_ADDRESS', '')

View File

@ -475,8 +475,7 @@ class PeerManager(util.LoggedClass):
def retry_peer(self, peer, port_pairs): def retry_peer(self, peer, port_pairs):
peer.last_try = time.time() peer.last_try = time.time()
kind, port = port_pairs[0] kind, port = port_pairs[0]
# Python 3.5.3: use PROTOCOL_TLS sslc = ssl.SSLContext(ssl.PROTOCOL_TLS) if kind == 'SSL' else None
sslc = ssl.SSLContext(ssl.PROTOCOL_SSLv23) if kind == 'SSL' else None
if peer.is_tor: if peer.is_tor:
create_connection = self.tor_proxy.create_connection create_connection = self.tor_proxy.create_connection

View File

@ -6,7 +6,7 @@ setuptools.setup(
name='electrumx', name='electrumx',
version=VERSION.split()[-1], version=VERSION.split()[-1],
scripts=['electrumx_server.py', 'electrumx_rpc.py'], scripts=['electrumx_server.py', 'electrumx_rpc.py'],
python_requires='>=3.5', python_requires='>=3.5.3',
# "irc" package is only required if IRC connectivity is enabled # "irc" package is only required if IRC connectivity is enabled
# via environment variables, in which case I've tested with 15.0.4 # via environment variables, in which case I've tested with 15.0.4
# "x11_hash" package (1.4) is required to sync DASH network. # "x11_hash" package (1.4) is required to sync DASH network.