Merge branch 'release-0.2.2' into develop
This commit is contained in:
commit
304501d792
@ -1,3 +1,10 @@
|
|||||||
|
Version 0.2.2.1
|
||||||
|
---------------
|
||||||
|
|
||||||
|
- fixes issues #12, #13
|
||||||
|
- only attempt to flush on asyncio.CancelledError to avoid spurious
|
||||||
|
secondary errors
|
||||||
|
|
||||||
Version 0.2.2
|
Version 0.2.2
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
|
|||||||
@ -382,8 +382,9 @@ class BlockProcessor(server.db.DB):
|
|||||||
while True:
|
while True:
|
||||||
await self._wait_for_update()
|
await self._wait_for_update()
|
||||||
await asyncio.sleep(0) # Yield
|
await asyncio.sleep(0) # Yield
|
||||||
finally:
|
except asyncio.CancelledError:
|
||||||
self.flush(True)
|
self.flush(True)
|
||||||
|
raise
|
||||||
|
|
||||||
async def _wait_for_update(self):
|
async def _wait_for_update(self):
|
||||||
'''Wait for the prefetcher to deliver blocks or a mempool update.
|
'''Wait for the prefetcher to deliver blocks or a mempool update.
|
||||||
@ -535,6 +536,9 @@ class BlockProcessor(server.db.DB):
|
|||||||
self.height - self.db_height))
|
self.height - self.db_height))
|
||||||
self.utxo_cache.flush(batch)
|
self.utxo_cache.flush(batch)
|
||||||
self.utxo_flush_count = self.flush_count
|
self.utxo_flush_count = self.flush_count
|
||||||
|
self.db_tx_count = self.tx_count
|
||||||
|
self.db_height = self.height
|
||||||
|
self.db_tip = self.tip
|
||||||
|
|
||||||
def assert_flushed(self):
|
def assert_flushed(self):
|
||||||
'''Asserts state is fully flushed.'''
|
'''Asserts state is fully flushed.'''
|
||||||
@ -572,13 +576,6 @@ class BlockProcessor(server.db.DB):
|
|||||||
self.flush_state(batch)
|
self.flush_state(batch)
|
||||||
self.logger.info('committing transaction...')
|
self.logger.info('committing transaction...')
|
||||||
|
|
||||||
# Update our in-memory state after successful flush
|
|
||||||
self.db_tx_count = self.tx_count
|
|
||||||
self.db_height = self.height
|
|
||||||
self.db_tip = self.tip
|
|
||||||
self.tx_hashes = []
|
|
||||||
self.headers = []
|
|
||||||
|
|
||||||
# Update and put the wall time again - otherwise we drop the
|
# Update and put the wall time again - otherwise we drop the
|
||||||
# time it took to commit the batch
|
# time it took to commit the batch
|
||||||
self.flush_state(self.db)
|
self.flush_state(self.db)
|
||||||
@ -670,6 +667,8 @@ class BlockProcessor(server.db.DB):
|
|||||||
|
|
||||||
os.sync()
|
os.sync()
|
||||||
|
|
||||||
|
self.tx_hashes = []
|
||||||
|
self.headers = []
|
||||||
self.logger.info('FS flush took {:.1f} seconds'
|
self.logger.info('FS flush took {:.1f} seconds'
|
||||||
.format(time.time() - flush_start))
|
.format(time.time() - flush_start))
|
||||||
|
|
||||||
|
|||||||
@ -119,7 +119,6 @@ class DB(LoggedClass):
|
|||||||
|
|
||||||
if tx_height > self.db_height:
|
if tx_height > self.db_height:
|
||||||
return None, tx_height
|
return None, tx_height
|
||||||
raise self.DBError('tx_num {:,d} is not on disk')
|
|
||||||
|
|
||||||
file_pos = tx_num * 32
|
file_pos = tx_num * 32
|
||||||
file_num, offset = divmod(file_pos, self.tx_hash_file_size)
|
file_num, offset = divmod(file_pos, self.tx_hash_file_size)
|
||||||
|
|||||||
@ -331,8 +331,8 @@ class ElectrumX(JSONRPC):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def watched_address_count(cls):
|
def watched_address_count(cls):
|
||||||
sessions = self.SESSION_MGR.sessions
|
sessions = cls.SESSION_MGR.sessions
|
||||||
return sum(len(session.hash168s) for session in session
|
return sum(len(session.hash168s) for session in sessions
|
||||||
if isinstance(session, cls))
|
if isinstance(session, cls))
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
VERSION = "ElectrumX 0.2.2"
|
VERSION = "ElectrumX 0.2.2.1"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user