commit c454564ed6e094aa36be9fbe7aa9e9113a28710c
parent 82da581d45cd1570fa5a361681324b6cee507ab5
Author: ThomasV <thomasv@electrum.org>
Date: Thu, 16 Apr 2020 10:58:40 +0200
sql_db: do not require network object
Diffstat:
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git 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
@@ -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: