Browse Source

Defer address notifications whilst processing a block

Partial fix of #70
master
Neil Booth 8 years ago
parent
commit
e88ea91e89
  1. 7
      server/mempool.py

7
server/mempool.py

@ -88,7 +88,8 @@ class MemPool(util.LoggedClass):
if unprocessed: if unprocessed:
await process_some(unprocessed) await process_some(unprocessed)
if self.touched: # Avoid double notifications if processing a block
if self.touched and not self.processing_new_block():
self.touched_event.set() self.touched_event.set()
if not unprocessed: if not unprocessed:
@ -101,6 +102,10 @@ class MemPool(util.LoggedClass):
except DaemonError as e: except DaemonError as e:
self.logger.info('ignoring daemon error: {}'.format(e)) self.logger.info('ignoring daemon error: {}'.format(e))
def processing_new_block(self):
'''Return True if we're processing a new block.'''
return self.daemon.cached_height() > self.db.db_height
async def new_hashes(self, unprocessed, unfetched): async def new_hashes(self, unprocessed, unfetched):
'''Get the current list of hashes in the daemon's mempool. '''Get the current list of hashes in the daemon's mempool.

Loading…
Cancel
Save