From a57b69391b390ebbd1b010b54ce0435fd3adc701 Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Tue, 5 Apr 2022 14:09:42 -0400 Subject: [PATCH] rename hub mempool class to HubMemPool --- scribe/hub/mempool.py | 2 +- scribe/hub/service.py | 4 ++-- scribe/hub/session.py | 8 ++------ 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/scribe/hub/mempool.py b/scribe/hub/mempool.py index c31f47e..e98b632 100644 --- a/scribe/hub/mempool.py +++ b/scribe/hub/mempool.py @@ -41,7 +41,7 @@ mempool_process_time_metric = Histogram( ) -class MemPool: +class HubMemPool: def __init__(self, coin, db: 'HubDB', refresh_secs=1.0): self.coin = coin self._db = db diff --git a/scribe/hub/service.py b/scribe/hub/service.py index cb7fcd7..b209995 100644 --- a/scribe/hub/service.py +++ b/scribe/hub/service.py @@ -3,7 +3,7 @@ import time import asyncio from scribe.blockchain.daemon import LBCDaemon from scribe.hub.session import SessionManager -from scribe.hub.mempool import MemPool +from scribe.hub.mempool import HubMemPool from scribe.hub.udp import StatusServer from scribe.service import BlockchainReaderService from scribe.elasticsearch import ElasticNotifierClientProtocol @@ -16,7 +16,7 @@ class HubServerService(BlockchainReaderService): self.mempool_notifications = set() self.status_server = StatusServer() self.daemon = LBCDaemon(env.coin, env.daemon_url) # only needed for broadcasting txs - self.mempool = MemPool(self.env.coin, self.db) + self.mempool = HubMemPool(self.env.coin, self.db) self.session_manager = SessionManager( env, self.db, self.mempool, self.daemon, self.shutdown_event, diff --git a/scribe/hub/session.py b/scribe/hub/session.py index 949ac5f..c0e90e1 100644 --- a/scribe/hub/session.py +++ b/scribe/hub/session.py @@ -30,7 +30,7 @@ if typing.TYPE_CHECKING: from scribe.db import HubDB from scribe.env import Env from scribe.blockchain.daemon import LBCDaemon - from scribe.hub.mempool import MemPool + from scribe.hub.mempool import HubMemPool BAD_REQUEST = 1 DAEMON_ERROR = 2 @@ -38,13 +38,10 @@ DAEMON_ERROR = 2 log = logging.getLogger(__name__) - SignatureInfo = namedtuple('SignatureInfo', 'min_args max_args ' 'required_names other_names') - - def scripthash_to_hashX(scripthash: str) -> bytes: try: bin_hash = hex_str_to_hash(scripthash) @@ -136,7 +133,6 @@ class SessionManager: tx_replied_count_metric = Counter("replied_transaction", "Number of transactions responded", namespace=NAMESPACE) urls_to_resolve_count_metric = Counter("urls_to_resolve", "Number of urls to resolve", namespace=NAMESPACE) resolved_url_count_metric = Counter("resolved_url", "Number of resolved urls", namespace=NAMESPACE) - interrupt_count_metric = Counter("interrupt", "Number of interrupted queries", namespace=NAMESPACE) db_operational_error_metric = Counter( "operational_error", "Number of queries that raised operational errors", namespace=NAMESPACE @@ -168,7 +164,7 @@ class SessionManager: namespace=NAMESPACE, buckets=HISTOGRAM_BUCKETS ) - def __init__(self, env: 'Env', db: 'HubDB', mempool: 'MemPool', + def __init__(self, env: 'Env', db: 'HubDB', mempool: 'HubMemPool', daemon: 'LBCDaemon', shutdown_event: asyncio.Event, on_available_callback: typing.Callable[[], None], on_unavailable_callback: typing.Callable[[], None]): env.max_send = max(350000, env.max_send)