lightning: single shared instance of Watcher, ChannelDB and PathFinder
This commit is contained in:
@@ -64,6 +64,10 @@ from .logging import get_logger, Logger
|
||||
_logger = get_logger(__name__)
|
||||
|
||||
|
||||
# lightning network
|
||||
from . import lnwatcher
|
||||
from . import lnrouter
|
||||
|
||||
NODES_RETRY_INTERVAL = 60
|
||||
SERVER_RETRY_INTERVAL = 10
|
||||
NUM_TARGET_CONNECTED_SERVERS = 10
|
||||
@@ -295,6 +299,11 @@ class Network(Logger):
|
||||
|
||||
self._set_status('disconnected')
|
||||
|
||||
# lightning network
|
||||
self.channel_db = lnrouter.ChannelDB()
|
||||
self.path_finder = lnrouter.LNPathFinder(self.channel_db)
|
||||
self.lnwatcher = lnwatcher.LNWatcher(self)
|
||||
|
||||
def run_from_another_thread(self, coro):
|
||||
assert self._loop_thread != threading.current_thread(), 'must not be called from network thread'
|
||||
fut = asyncio.run_coroutine_threadsafe(coro, self.asyncio_loop)
|
||||
|
||||
Reference in New Issue
Block a user