This commit is contained in:
Jack Robison 2022-05-12 12:48:11 -04:00
parent 708c45504a
commit 32c21a26a9
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
2 changed files with 5 additions and 4 deletions

View file

@ -864,7 +864,7 @@ class HubDB:
self.prefix_db.close() self.prefix_db.close()
self.prefix_db = None 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) mempool_status = self.prefix_db.hashX_mempool_status.get(hashX, deserialize_value=False)
if mempool_status: if mempool_status:
return mempool_status.hex() return mempool_status.hex()
@ -872,6 +872,9 @@ class HubDB:
if status: if status:
return status.hex() 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: def get_tx_hash(self, tx_num: int) -> bytes:
if self._cache_all_tx_hashes: if self._cache_all_tx_hashes:
return self.total_transactions[tx_num] return self.total_transactions[tx_num]

View file

@ -1089,10 +1089,8 @@ class LBRYElectrumX(asyncio.Protocol):
return len(self.hashX_subs) return len(self.hashX_subs)
async def get_hashX_status(self, hashX: bytes): async def get_hashX_status(self, hashX: bytes):
self.session_manager.db.last_flush
if self.env.index_address_status: if self.env.index_address_status:
loop = self.loop return await self.db.get_hashX_status(hashX)
return await loop.run_in_executor(None, self.db.get_hashX_status, hashX)
history = ''.join( history = ''.join(
f"{tx_hash[::-1].hex()}:{height:d}:" f"{tx_hash[::-1].hex()}:{height:d}:"
for tx_hash, height in await self.db.limited_history(hashX, limit=None) for tx_hash, height in await self.db.limited_history(hashX, limit=None)