Simplify refresh hashes loop
This commit is contained in:
parent
821f907971
commit
4da95dd853
@ -56,15 +56,13 @@ class MemPool(object):
|
|||||||
await self._synchronize(False)
|
await self._synchronize(False)
|
||||||
|
|
||||||
async def _refresh_hashes(self):
|
async def _refresh_hashes(self):
|
||||||
'''Return daemon hashes when we're sure which height they are
|
'''Return a (hash set, height) pair when we're sure which height they
|
||||||
good for.'''
|
are for.'''
|
||||||
height = self.daemon.cached_height()
|
|
||||||
while True:
|
while True:
|
||||||
|
height = self.daemon.cached_height()
|
||||||
hashes = await self.daemon.mempool_hashes()
|
hashes = await self.daemon.mempool_hashes()
|
||||||
later_height = await self.daemon.height()
|
if height == await self.daemon.height():
|
||||||
if height == later_height:
|
|
||||||
return set(hashes), height
|
return set(hashes), height
|
||||||
height = later_height
|
|
||||||
|
|
||||||
async def _synchronize(self, first_time):
|
async def _synchronize(self, first_time):
|
||||||
'''Asynchronously maintain mempool status with daemon.
|
'''Asynchronously maintain mempool status with daemon.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user