Browse Source

Remove obsolete debugging feature

master
Neil Booth 8 years ago
parent
commit
8970205e6c
  1. 3
      server/block_processor.py
  2. 12
      server/daemon.py
  3. 2
      server/env.py

3
server/block_processor.py

@ -142,8 +142,7 @@ class BlockProcessor(server.db.DB):
self.tip = self.db_tip self.tip = self.db_tip
self.tx_count = self.db_tx_count self.tx_count = self.db_tx_count
self.daemon = Daemon(self.coin.daemon_urls(env.daemon_url), env.debug) self.daemon = Daemon(self.coin.daemon_urls(env.daemon_url))
self.daemon.debug_set_height(self.height)
self.caught_up = False self.caught_up = False
self.touched = set() self.touched = set()
self.futures = [] self.futures = []

12
server/daemon.py

@ -27,7 +27,7 @@ class Daemon(util.LoggedClass):
class DaemonWarmingUpError(Exception): class DaemonWarmingUpError(Exception):
'''Raised when the daemon returns an error in its results.''' '''Raised when the daemon returns an error in its results.'''
def __init__(self, urls, debug): def __init__(self, urls):
super().__init__() super().__init__()
if not urls: if not urls:
raise DaemonError('no daemon URLs provided') raise DaemonError('no daemon URLs provided')
@ -36,17 +36,10 @@ class Daemon(util.LoggedClass):
self.urls = urls self.urls = urls
self.url_index = 0 self.url_index = 0
self._height = None self._height = None
self.debug_caught_up = 'caught_up' in debug
# Limit concurrent RPC calls to this number. # Limit concurrent RPC calls to this number.
# See DEFAULT_HTTP_WORKQUEUE in bitcoind, which is typically 16 # See DEFAULT_HTTP_WORKQUEUE in bitcoind, which is typically 16
self.workqueue_semaphore = asyncio.Semaphore(value=10) self.workqueue_semaphore = asyncio.Semaphore(value=10)
def debug_set_height(self, height):
if self.debug_caught_up:
self.logger.info('pretending to have caught up to height {}'
.format(height))
self._height = height
async def _send(self, payload, processor): async def _send(self, payload, processor):
'''Send a payload to be converted to JSON. '''Send a payload to be converted to JSON.
@ -157,8 +150,6 @@ class Daemon(util.LoggedClass):
async def mempool_hashes(self): async def mempool_hashes(self):
'''Return the hashes of the txs in the daemon's mempool.''' '''Return the hashes of the txs in the daemon's mempool.'''
if self.debug_caught_up:
return []
return await self._send_single('getrawmempool') return await self._send_single('getrawmempool')
async def estimatefee(self, params): async def estimatefee(self, params):
@ -191,7 +182,6 @@ class Daemon(util.LoggedClass):
async def height(self): async def height(self):
'''Query the daemon for its current height.''' '''Query the daemon for its current height.'''
if not self.debug_caught_up:
self._height = await self._send_single('getblockcount') self._height = await self._send_single('getblockcount')
return self._height return self._height

2
server/env.py

@ -44,8 +44,6 @@ class Env(LoggedClass):
# 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', '')
self.db_engine = self.default('DB_ENGINE', 'leveldb') self.db_engine = self.default('DB_ENGINE', 'leveldb')
self.debug = self.default('DEBUG', '')
self.debug = [item.lower() for item in self.debug.split()]
# Subscription limits # Subscription limits
self.max_subs = self.integer('MAX_SUBS', 250000) self.max_subs = self.integer('MAX_SUBS', 250000)
self.max_session_subs = self.integer('MAX_SESSION_SUBS', 50000) self.max_session_subs = self.integer('MAX_SESSION_SUBS', 50000)

Loading…
Cancel
Save