Browse Source

sql_db: do not require network object

ssl-fingerprint-check
ThomasV 5 years ago
parent
commit
c454564ed6
  1. 2
      electrum/channel_db.py
  2. 6
      electrum/sql_db.py

2
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

6
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:

Loading…
Cancel
Save