fix updating the block height in udp pong responses

This commit is contained in:
Jack Robison 2022-06-16 15:26:54 -04:00
parent 1a5fd214b9
commit 6c0f901d33
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
3 changed files with 4 additions and 7 deletions

View file

@ -942,7 +942,6 @@ class SecondaryDB:
self.read_db_state() self.read_db_state()
# These are our state as we move ahead of DB state # These are our state as we move ahead of DB state
self.fs_height = self.db_height
self.fs_tx_count = self.db_tx_count self.fs_tx_count = self.db_tx_count
self.last_flush_tx_count = self.fs_tx_count self.last_flush_tx_count = self.fs_tx_count

View file

@ -86,9 +86,9 @@ class HubServerService(BlockchainReaderService):
async def poll_for_changes(self): async def poll_for_changes(self):
await super().poll_for_changes() await super().poll_for_changes()
if self.db.fs_height <= 0: if self.db.db_height <= 0:
return return
self.status_server.set_height(self.db.fs_height, self.db.db_tip) self.status_server.set_height(self.db.db_height, self.db.db_tip)
if self.notifications_to_send: if self.notifications_to_send:
for (touched, height) in self.notifications_to_send: for (touched, height) in self.notifications_to_send:
await self.mempool.on_block(touched, height) await self.mempool.on_block(touched, height)

View file

@ -1396,7 +1396,6 @@ class BlockchainProcessorService(BlockchainService):
self.db.block_hashes.append(self.env.coin.header_hash(block.header)) self.db.block_hashes.append(self.env.coin.header_hash(block.header))
self.tip = self.coin.header_hash(block.header) self.tip = self.coin.header_hash(block.header)
self.db.fs_height = self.height
self.db.fs_tx_count = self.tx_count self.db.fs_tx_count = self.tx_count
self.db.hist_flush_count += 1 self.db.hist_flush_count += 1
self.db.hist_unflushed_count = 0 self.db.hist_unflushed_count = 0
@ -1591,10 +1590,9 @@ class BlockchainProcessorService(BlockchainService):
# Not certain this is needed, but it doesn't hurt # Not certain this is needed, but it doesn't hurt
self.db.hist_flush_count += 1 self.db.hist_flush_count += 1
while self.db.fs_height > self.height: while self.db.db_height > self.height:
self.db.fs_height -= 1 self.db.db_height -= 1
self.db.utxo_flush_count = self.db.hist_flush_count self.db.utxo_flush_count = self.db.hist_flush_count
self.db.db_height = self.height
self.db.db_tx_count = self.tx_count self.db.db_tx_count = self.tx_count
self.db.db_tip = self.tip self.db.db_tip = self.tip
# Flush state last as it reads the wall time. # Flush state last as it reads the wall time.