Move assert_flushed DB logic to db.py
This commit is contained in:
parent
70319bb22d
commit
d87c3dedcf
@ -324,12 +324,10 @@ class BlockProcessor(electrumx.server.db.DB):
|
|||||||
|
|
||||||
def assert_flushed(self):
|
def assert_flushed(self):
|
||||||
'''Asserts state is fully flushed.'''
|
'''Asserts state is fully flushed.'''
|
||||||
assert self.tx_count == self.fs_tx_count == self.db_tx_count
|
|
||||||
assert self.height == self.fs_height == self.db_height
|
|
||||||
assert not self.undo_infos
|
assert not self.undo_infos
|
||||||
assert not self.utxo_cache
|
assert not self.utxo_cache
|
||||||
assert not self.db_deletes
|
assert not self.db_deletes
|
||||||
self.history.assert_flushed()
|
self.db_assert_flushed(self.tx_count, self.height)
|
||||||
|
|
||||||
async def flush(self, flush_utxos):
|
async def flush(self, flush_utxos):
|
||||||
if self.height == self.db_height:
|
if self.height == self.db_height:
|
||||||
|
|||||||
@ -149,6 +149,13 @@ class DB(object):
|
|||||||
async def header_branch_and_root(self, length, height):
|
async def header_branch_and_root(self, length, height):
|
||||||
return await self.header_mc.branch_and_root(length, height)
|
return await self.header_mc.branch_and_root(length, height)
|
||||||
|
|
||||||
|
# Flushing
|
||||||
|
def db_assert_flushed(self, to_tx_count, to_height):
|
||||||
|
'''Asserts state is fully flushed.'''
|
||||||
|
assert to_tx_count == self.fs_tx_count == self.db_tx_count
|
||||||
|
assert to_height == self.fs_height == self.db_height
|
||||||
|
self.history.assert_flushed()
|
||||||
|
|
||||||
def fs_update_header_offsets(self, offset_start, height_start, headers):
|
def fs_update_header_offsets(self, offset_start, height_start, headers):
|
||||||
if self.coin.STATIC_BLOCK_HEADERS:
|
if self.coin.STATIC_BLOCK_HEADERS:
|
||||||
return
|
return
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user