Browse Source

Handle the case there are no blocks

patch-2
Neil Booth 7 years ago
parent
commit
bef04750d7
  1. 3
      electrumx/server/block_processor.py

3
electrumx/server/block_processor.py

@ -202,6 +202,8 @@ class BlockProcessor(electrumx.server.db.DB):
'''Process the list of raw blocks passed. Detects and handles '''Process the list of raw blocks passed. Detects and handles
reorgs. reorgs.
''' '''
if not raw_blocks:
return
first = self.height + 1 first = self.height + 1
blocks = [self.coin.block(raw_block, first + n) blocks = [self.coin.block(raw_block, first + n)
for n, raw_block in enumerate(raw_blocks)] for n, raw_block in enumerate(raw_blocks)]
@ -813,7 +815,6 @@ class BlockProcessor(electrumx.server.db.DB):
Returns True if a reorg is queued, false if not caught up. Returns True if a reorg is queued, false if not caught up.
''' '''
if self._caught_up_event.is_set(): if self._caught_up_event.is_set():
if count > 0:
self.reorg_count = count self.reorg_count = count
self.blocks_event.set() self.blocks_event.set()
return True return True

Loading…
Cancel
Save