dead code

This commit is contained in:
Jack Robison 2021-05-05 15:53:17 -04:00
parent 6d4c1cd879
commit 103bdc151f
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
2 changed files with 3 additions and 14 deletions

View file

@ -362,15 +362,6 @@ class BlockProcessor:
return start, count return start, count
def estimate_txs_remaining(self):
# Try to estimate how many txs there are to go
daemon_height = self.daemon.cached_height()
coin = self.coin
tail_count = daemon_height - max(self.height, coin.TX_COUNT_HEIGHT)
# Damp the initial enthusiasm
realism = max(2.0 - 0.9 * self.height / coin.TX_COUNT_HEIGHT, 1.0)
return (tail_count * coin.TX_PER_BLOCK +
max(coin.TX_COUNT - self.tx_count, 0)) * realism
# - Flushing # - Flushing
def flush_data(self): def flush_data(self):
@ -382,7 +373,7 @@ class BlockProcessor:
async def flush(self, flush_utxos): async def flush(self, flush_utxos):
def flush(): def flush():
self.db.flush_dbs(self.flush_data(), self.estimate_txs_remaining) self.db.flush_dbs(self.flush_data())
await self.run_in_thread_with_lock(flush) await self.run_in_thread_with_lock(flush)
async def _maybe_flush(self): async def _maybe_flush(self):

View file

@ -623,7 +623,7 @@ class LevelDB:
assert not flush_data.undo_infos assert not flush_data.undo_infos
assert not self.hist_unflushed assert not self.hist_unflushed
def flush_dbs(self, flush_data: FlushData, estimate_txs_remaining): def flush_dbs(self, flush_data: FlushData):
"""Flush out cached state. History is always flushed; UTXOs are """Flush out cached state. History is always flushed; UTXOs are
flushed if flush_utxos.""" flushed if flush_utxos."""
@ -760,11 +760,9 @@ class LevelDB:
flush_interval = self.last_flush - prior_flush flush_interval = self.last_flush - prior_flush
tx_per_sec_gen = int(flush_data.tx_count / self.wall_time) tx_per_sec_gen = int(flush_data.tx_count / self.wall_time)
tx_per_sec_last = 1 + int(tx_delta / flush_interval) tx_per_sec_last = 1 + int(tx_delta / flush_interval)
eta = estimate_txs_remaining() / tx_per_sec_last
self.logger.info(f'tx/sec since genesis: {tx_per_sec_gen:,d}, ' self.logger.info(f'tx/sec since genesis: {tx_per_sec_gen:,d}, '
f'since last flush: {tx_per_sec_last:,d}') f'since last flush: {tx_per_sec_last:,d}')
self.logger.info(f'sync time: {formatted_time(self.wall_time)} ' self.logger.info(f'sync time: {formatted_time(self.wall_time)}')
f'ETA: {formatted_time(eta)}')
def flush_backup(self, flush_data, touched): def flush_backup(self, flush_data, touched):
"""Like flush_dbs() but when backing up. All UTXOs are flushed.""" """Like flush_dbs() but when backing up. All UTXOs are flushed."""