From 32c21a26a9b5b25014b9dd800aa419af75146c9f Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Thu, 12 May 2022 12:48:11 -0400 Subject: [PATCH] cleanup --- scribe/db/db.py | 5 ++++- scribe/hub/session.py | 4 +--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/scribe/db/db.py b/scribe/db/db.py index 8cdb643..b569a47 100644 --- a/scribe/db/db.py +++ b/scribe/db/db.py @@ -864,7 +864,7 @@ class HubDB: self.prefix_db.close() self.prefix_db = None - def get_hashX_status(self, hashX: bytes): + def _get_hashX_status(self, hashX: bytes): mempool_status = self.prefix_db.hashX_mempool_status.get(hashX, deserialize_value=False) if mempool_status: return mempool_status.hex() @@ -872,6 +872,9 @@ class HubDB: if status: return status.hex() + async def get_hashX_status(self, hashX: bytes): + return await asyncio.get_event_loop().run_in_executor(self._executor, self._get_hashX_status, hashX) + def get_tx_hash(self, tx_num: int) -> bytes: if self._cache_all_tx_hashes: return self.total_transactions[tx_num] diff --git a/scribe/hub/session.py b/scribe/hub/session.py index 21df5be..594ee7a 100644 --- a/scribe/hub/session.py +++ b/scribe/hub/session.py @@ -1089,10 +1089,8 @@ class LBRYElectrumX(asyncio.Protocol): return len(self.hashX_subs) async def get_hashX_status(self, hashX: bytes): - self.session_manager.db.last_flush if self.env.index_address_status: - loop = self.loop - return await loop.run_in_executor(None, self.db.get_hashX_status, hashX) + return await self.db.get_hashX_status(hashX) history = ''.join( f"{tx_hash[::-1].hex()}:{height:d}:" for tx_hash, height in await self.db.limited_history(hashX, limit=None)