Fix reorg crash due a missing await (#555)

This commit is contained in:
John L. Jegutanis 2018-08-05 11:49:50 +02:00 committed by Neil
parent 02a34d05c2
commit dbfe9096c2

View File

@ -263,7 +263,7 @@ class BlockProcessor(electrumx.server.db.DB):
The hashes are returned in order of increasing height. Start The hashes are returned in order of increasing height. Start
is the height of the first hash, last of the last. is the height of the first hash, last of the last.
''' '''
start, count = self.calc_reorg_range(count) start, count = await self.calc_reorg_range(count)
last = start + count - 1 last = start + count - 1
s = '' if count == 1 else 's' s = '' if count == 1 else 's'
self.logger.info(f'chain was reorganised replacing {count:,d} ' self.logger.info(f'chain was reorganised replacing {count:,d} '
@ -835,7 +835,7 @@ class BlockProcessor(electrumx.server.db.DB):
class DecredBlockProcessor(BlockProcessor): class DecredBlockProcessor(BlockProcessor):
async def calc_reorg_range(self, count): async def calc_reorg_range(self, count):
start, count = super().calc_reorg_range(count) start, count = await super().calc_reorg_range(count)
if start > 0: if start > 0:
# A reorg in Decred can invalidate the previous block # A reorg in Decred can invalidate the previous block
start -= 1 start -= 1