diff --git a/README.rst b/README.rst index 6b32929..ccd46e0 100644 --- a/README.rst +++ b/README.rst @@ -113,10 +113,8 @@ be necessary. Roadmap Pre-1.0 =============== -- minor code cleanups -- at most 1 more DB format change; I will make a weak attempt to - retain 0.6 release's DB format if possible -- provision of bandwidth limit controls +- minor code cleanups. It is unlikely DB format will change +- better DoS protections and mempool handling - implement simple protocol to discover peers without resorting to IRC diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 6140ddc..78c83b1 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,8 @@ +version 0.8.4 +------------- + +- remove invalidated histories from cache on new block + version 0.8.3 ------------- diff --git a/electrumx_rpc.py b/electrumx_rpc.py index 47cb8f6..4535000 100755 --- a/electrumx_rpc.py +++ b/electrumx_rpc.py @@ -58,7 +58,7 @@ def main(): args = parser.parse_args() if args.port is None: - args.port = int(environ.get('ELECTRUMX_RPC_PORT', 8000)) + args.port = int(environ.get('RPC_PORT', 8000)) loop = asyncio.get_event_loop() coro = loop.create_connection(RPCClient, 'localhost', args.port) diff --git a/lib/jsonrpc.py b/lib/jsonrpc.py index 861b565..d3d7390 100644 --- a/lib/jsonrpc.py +++ b/lib/jsonrpc.py @@ -145,7 +145,7 @@ class JSONRPC(asyncio.Protocol, LoggedClass): self.recv_size += len(data) self.using_bandwidth(len(data)) - # Close abuvsive connections where buffered data exceeds limit + # Close abusive connections where buffered data exceeds limit buffer_size = len(data) + sum(len(part) for part in self.parts) if buffer_size > self.max_buffer_size: self.log_error('read buffer of {:,d} bytes exceeds {:,d} ' diff --git a/server/protocol.py b/server/protocol.py index 6696c52..70d5014 100644 --- a/server/protocol.py +++ b/server/protocol.py @@ -15,7 +15,7 @@ import ssl import time import traceback from collections import defaultdict, namedtuple -from functools import partial, lru_cache +from functools import partial import pylru @@ -231,7 +231,7 @@ class ServerManager(util.LoggedClass): self.max_subs = env.max_subs self.subscription_count = 0 self.next_stale_check = 0 - self.history_cache = pylru.lrucache(512) + self.history_cache = pylru.lrucache(128) self.futures = [] env.max_send = max(350000, env.max_send) self.logger.info('session timeout: {:,d} seconds' @@ -318,6 +318,10 @@ class ServerManager(util.LoggedClass): def notify(self, touched): '''Notify sessions about height changes and touched addresses.''' + # Remove invalidated history cache + hc = self.history_cache + for hash168 in set(hc).intersection(touched): + del hc[hash168] cache = {} for session in self.sessions: if isinstance(session, ElectrumX): @@ -537,8 +541,8 @@ class Session(JSONRPC): '''Base class of ElectrumX JSON session protocols. Each session runs its tasks in asynchronous parallelism with other - sessions. To prevent some sessions blocking othersr, potentially - long-running requests should yield (not yet implemented). + sessions. To prevent some sessions blocking others, potentially + long-running requests should yield. ''' def __init__(self, manager, bp, env, kind): diff --git a/server/version.py b/server/version.py index 5e72ebe..23e3031 100644 --- a/server/version.py +++ b/server/version.py @@ -1 +1 @@ -VERSION = "ElectrumX 0.8.3" +VERSION = "ElectrumX 0.8.4"