From 362499778ae6b30135336fa943d798219c113917 Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Mon, 16 Jul 2018 18:22:48 +0800 Subject: [PATCH] Prepare 1.6pre1 --- docs/changelog.rst | 6 ++++++ docs/conf.py | 2 +- docs/protocol-basics.rst | 2 +- electrumx/__init__.py | 3 +++ electrumx/server/block_processor.py | 3 ++- electrumx/server/controller.py | 16 +++++----------- electrumx/server/session.py | 7 ++++--- electrumx/server/version.py | 1 - setup.py | 2 +- 9 files changed, 23 insertions(+), 19 deletions(-) delete mode 100644 electrumx/server/version.py diff --git a/docs/changelog.rst b/docs/changelog.rst index d11c83f..16a50e3 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -7,6 +7,12 @@ and memory consumption whilst serving clients. Those problems should not occur with Python 3.7. +Version 1.6 +=========== + +* implement :ref:`version 1.4` of the protocol, with benefit for light + clients, particularly mobile + Version 1.5.2 ============= diff --git a/docs/conf.py b/docs/conf.py index 38d9cb4..4066338 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -15,7 +15,7 @@ import os import sys sys.path.insert(0, os.path.abspath('..')) -VERSION="1.5.2" +VERSION="ElectrumX 1.6" # -- Project information ----------------------------------------------------- diff --git a/docs/protocol-basics.rst b/docs/protocol-basics.rst index 532545e..606cef2 100644 --- a/docs/protocol-basics.rst +++ b/docs/protocol-basics.rst @@ -223,7 +223,7 @@ provided for the final header - the *prev_hash* links in the headers are sufficient to prove the others valid. Using this feature client software only needs to download the headers -it is interested in up to the checkpoint. HHeaders after the +it is interested in up to the checkpoint. Headers after the checkpoint must all be downloaded and validated as before. The RPC calls return the merkle root, so to embed a checkpoint in a client simply make an RPC request to a couple of trusted servers for the diff --git a/electrumx/__init__.py b/electrumx/__init__.py index 517c9ff..0a901ea 100644 --- a/electrumx/__init__.py +++ b/electrumx/__init__.py @@ -1,2 +1,5 @@ +version = 'ElectrumX 1.6pre1' +version_short = version.split()[-1] + from electrumx.server.controller import Controller from electrumx.server.env import Env diff --git a/electrumx/server/block_processor.py b/electrumx/server/block_processor.py index f9a7a77..b7fdeb3 100644 --- a/electrumx/server/block_processor.py +++ b/electrumx/server/block_processor.py @@ -15,6 +15,7 @@ from struct import pack, unpack import time from functools import partial +import electrumx from electrumx.server.daemon import DaemonError from electrumx.lib.hash import hash_to_hex_str, HASHX_LEN from electrumx.lib.util import chunks, formatted_time, class_logger @@ -216,7 +217,7 @@ class BlockProcessor(electrumx.server.db.DB): self.first_sync = False await self.controller.run_in_executor(self.flush, True) if self.utxo_db.for_sync: - self.logger.info(f'{self.controller.VERSION} synced to ' + self.logger.info(f'{electrumx.version} synced to ' f'height {self.height:,d}') self.open_dbs() self.caught_up_event.set() diff --git a/electrumx/server/controller.py b/electrumx/server/controller.py index 821d9d0..2263fba 100644 --- a/electrumx/server/controller.py +++ b/electrumx/server/controller.py @@ -20,6 +20,7 @@ from functools import partial import pylru from aiorpcx import RPCError, TaskSet, _version as aiorpcx_version +import electrumx from electrumx.lib.hash import hash_to_hex_str, hex_str_to_hash from electrumx.lib.hash import HASHX_LEN from electrumx.lib.merkle import Merkle, MerkleCache @@ -30,7 +31,6 @@ from electrumx.server.daemon import DaemonError from electrumx.server.mempool import MemPool from electrumx.server.peers import PeerManager from electrumx.server.session import LocalRPC, BAD_REQUEST, DAEMON_ERROR -from electrumx.server.version import VERSION version_string = util.version_string @@ -62,7 +62,6 @@ class Controller(ServerBase): PROTOCOL_MIN = '1.1' PROTOCOL_MAX = '1.4' AIORPCX_MIN = (0, 5, 6) - VERSION = VERSION def __init__(self, env): '''Initialize everything that doesn't require the event loop.''' @@ -71,7 +70,7 @@ class Controller(ServerBase): raise RuntimeError('ElectrumX requires aiorpcX >= ' f'{version_string(self.AIORPCX_MIN)}') - self.logger.info(f'software version: {self.VERSION}') + self.logger.info(f'software version: {electrumx.version}') self.logger.info(f'aiorpcX version: {version_string(aiorpcx_version)}') self.logger.info(f'supported protocol versions: ' f'{self.PROTOCOL_MIN}-{self.PROTOCOL_MAX}') @@ -115,17 +114,12 @@ class Controller(ServerBase): # Event triggered when electrumx is listening for incoming requests. self.server_listening = asyncio.Event() - @classmethod - def short_version(cls): - '''Return e.g. "1.2" for ElectrumX 1.2''' - return cls.VERSION.split()[-1] - def server_features(self): '''Return the server features dictionary.''' return { 'hosts': self.env.hosts_dict(), 'pruning': None, - 'server_version': self.VERSION, + 'server_version': electrumx.version, 'protocol_min': self.PROTOCOL_MIN, 'protocol_max': self.PROTOCOL_MAX, 'genesis_hash': self.coin.GENESIS_HASH, @@ -134,7 +128,7 @@ class Controller(ServerBase): def server_version_args(self): '''The arguments to a server.version RPC call to a peer.''' - return [self.VERSION, [self.PROTOCOL_MIN, self.PROTOCOL_MAX]] + return [electrumx.version, [self.PROTOCOL_MIN, self.PROTOCOL_MAX]] def protocol_tuple(self, client_protocol_str): '''Given a client's protocol version string, return the negotiated @@ -421,7 +415,7 @@ class Controller(ServerBase): '''A one-line summary of server state.''' group_map = self._group_map() return { - 'version': VERSION, + 'version': electrumx.version, 'daemon': self.daemon.logged_url(), 'daemon_height': self.daemon.cached_height(), 'db_height': self.bp.db_height, diff --git a/electrumx/server/session.py b/electrumx/server/session.py index 1a336cd..28f5981 100644 --- a/electrumx/server/session.py +++ b/electrumx/server/session.py @@ -15,6 +15,7 @@ from functools import partial from aiorpcx import ServerSession, JSONRPCAutoDetect, RPCError +import electrumx from electrumx.lib.hash import sha256, hash_to_hex_str import electrumx.lib.util as util from electrumx.server.daemon import DaemonError @@ -378,8 +379,8 @@ class ElectrumX(SessionBase): revision //= 100 daemon_version = '{:d}.{:d}.{:d}'.format(major, minor, revision) for pair in [ - ('$SERVER_VERSION', self.controller.short_version()), - ('$SERVER_SUBVERSION', self.controller.VERSION), + ('$SERVER_VERSION', electrumx.version_short), + ('$SERVER_SUBVERSION', electrumx.version), ('$DAEMON_VERSION', daemon_version), ('$DAEMON_SUBVERSION', network_info['subversion']), ('$DONATION_ADDRESS', self.env.donation_address), @@ -448,7 +449,7 @@ class ElectrumX(SessionBase): self.set_protocol_handlers(ptuple) - return (self.controller.VERSION, self.protocol_version) + return (electrumx.version, self.protocol_version) async def transaction_broadcast(self, raw_tx): '''Broadcast a raw transaction to the network. diff --git a/electrumx/server/version.py b/electrumx/server/version.py deleted file mode 100644 index 137eb2f..0000000 --- a/electrumx/server/version.py +++ /dev/null @@ -1 +0,0 @@ -VERSION = 'ElectrumX 1.5.2' diff --git a/setup.py b/setup.py index 1b06116..66bfbd0 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,5 @@ import setuptools -version = '1.5.2' +version = '1.6' setuptools.setup( name='electrumX',