1
0

lightning: single shared instance of Watcher, ChannelDB and PathFinder

This commit is contained in:
ThomasV
2018-06-26 12:10:03 +02:00
parent 3fd3b2a74d
commit 61983c222a
4 changed files with 15 additions and 11 deletions

View File

@@ -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)