Browse Source

Require Python 3.5.3

3.5.2 has various socket and API issues affecting peer discovery

Closes #135
master
Neil Booth 8 years ago
parent
commit
39bcdb1b6a
  1. 2
      README.rst
  2. 4
      docs/ENVIRONMENT.rst
  3. 3
      docs/HOWTO.rst
  4. 6
      electrumx_server.py
  5. 3
      server/controller.py
  6. 3
      server/env.py
  7. 3
      server/peers.py
  8. 2
      setup.py

2
README.rst

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

4
docs/ENVIRONMENT.rst

@ -252,9 +252,7 @@ some of this.
* **TOR_PROXY_HOST**
The host where your Tor proxy is running. Defaults to *127.0.0.1*.
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.
The host where your Tor proxy is running. Defaults to *localhost*.
If you are not running a Tor proxy just leave this environment
variable undefined.

3
docs/HOWTO.rst

@ -10,7 +10,8 @@ small - pull requests are welcome.
================ ========================
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 >=
1.0 required; I am using 1.0.5.
`pylru`_ Python LRU cache package. I'm using 1.0.9.

6
electrumx_server.py

@ -13,6 +13,7 @@ import asyncio
import logging
import os
import signal
import sys
import traceback
from functools import partial
@ -28,8 +29,11 @@ SUPPRESS_MESSAGES = [
def main_loop():
'''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:
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')
loop = asyncio.get_event_loop()

3
server/controller.py

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

3
server/env.py

@ -51,8 +51,7 @@ class Env(LoggedClass):
# Peer discovery
self.peer_discovery = bool(self.default('PEER_DISCOVERY', 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', '127.0.0.1')
self.tor_proxy_host = self.default('TOR_PROXY_HOST', 'localhost')
self.tor_proxy_port = self.integer('TOR_PROXY_PORT', None)
# The electrum client takes the empty string as unspecified
self.donation_address = self.default('DONATION_ADDRESS', '')

3
server/peers.py

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

2
setup.py

@ -6,7 +6,7 @@ setuptools.setup(
name='electrumx',
version=VERSION.split()[-1],
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
# via environment variables, in which case I've tested with 15.0.4
# "x11_hash" package (1.4) is required to sync DASH network.

Loading…
Cancel
Save