From c454564ed6e094aa36be9fbe7aa9e9113a28710c Mon Sep 17 00:00:00 2001 From: ThomasV Date: Thu, 16 Apr 2020 10:58:40 +0200 Subject: [PATCH] sql_db: do not require network object --- electrum/channel_db.py | 2 +- electrum/sql_db.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/electrum/channel_db.py b/electrum/channel_db.py index e374519d5..50cb21234 100644 --- a/electrum/channel_db.py +++ b/electrum/channel_db.py @@ -242,7 +242,7 @@ class ChannelDB(SqlDB): def __init__(self, network: 'Network'): path = os.path.join(get_headers_dir(network.config), 'gossip_db') - super().__init__(network, path, commit_interval=100) + super().__init__(network.asyncio_loop, path, commit_interval=100) self.lock = threading.RLock() self.num_nodes = 0 self.num_channels = 0 diff --git a/electrum/sql_db.py b/electrum/sql_db.py index 8cd793c0c..fddd03b23 100644 --- a/electrum/sql_db.py +++ b/electrum/sql_db.py @@ -19,9 +19,9 @@ def sql(func): class SqlDB(Logger): - def __init__(self, network, path, commit_interval=None): + def __init__(self, asyncio_loop, path, commit_interval=None): Logger.__init__(self) - self.network = network + self.asyncio_loop = asyncio_loop self.path = path self.commit_interval = commit_interval self.db_requests = queue.Queue() @@ -34,7 +34,7 @@ class SqlDB(Logger): self.logger.info("Creating database") self.create_database() i = 0 - while self.network.asyncio_loop.is_running(): + while self.asyncio_loop.is_running(): try: future, func, args, kwargs = self.db_requests.get(timeout=0.1) except queue.Empty: