Daemon constructor passed coin and URLs directly
This commit is contained in:
parent
a108817dd4
commit
13a8b62d8c
@ -92,9 +92,11 @@ class Controller(ServerBase):
|
|||||||
self.logger.info(f'reorg limit is {env.reorg_limit:,d} blocks')
|
self.logger.info(f'reorg limit is {env.reorg_limit:,d} blocks')
|
||||||
|
|
||||||
notifications = Notifications()
|
notifications = Notifications()
|
||||||
daemon = env.coin.DAEMON(env)
|
Daemon = env.coin.DAEMON
|
||||||
db = DB(env)
|
|
||||||
BlockProcessor = env.coin.BLOCK_PROCESSOR
|
BlockProcessor = env.coin.BLOCK_PROCESSOR
|
||||||
|
|
||||||
|
daemon = Daemon(env.coin, env.daemon_url)
|
||||||
|
db = DB(env)
|
||||||
bp = BlockProcessor(env, db, daemon, notifications)
|
bp = BlockProcessor(env, db, daemon, notifications)
|
||||||
|
|
||||||
# Set ourselves up to implement the MemPoolAPI
|
# Set ourselves up to implement the MemPoolAPI
|
||||||
|
|||||||
@ -37,14 +37,14 @@ class Daemon(object):
|
|||||||
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, env):
|
def __init__(self, coin, urls, max_workqueue=10):
|
||||||
|
self.coin = coin
|
||||||
self.logger = class_logger(__name__, self.__class__.__name__)
|
self.logger = class_logger(__name__, self.__class__.__name__)
|
||||||
self.coin = env.coin
|
self.set_urls(coin.daemon_urls(urls))
|
||||||
self.set_urls(env.coin.daemon_urls(env.daemon_url))
|
|
||||||
self._height = None
|
self._height = None
|
||||||
# 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=max_workqueue)
|
||||||
self.down = False
|
self.down = False
|
||||||
self.last_error_time = 0
|
self.last_error_time = 0
|
||||||
self.req_id = 0
|
self.req_id = 0
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user