initialize TX_COUNTS_STATE from existing TX_COUNT_PREFIX
This commit is contained in:
parent
c03b1b5a93
commit
ede167bb56
2 changed files with 5 additions and 3 deletions
|
@ -131,7 +131,7 @@ class Ledger(metaclass=LedgerRegistry):
|
|||
self._on_transaction_controller = StreamController()
|
||||
self.on_transaction = self._on_transaction_controller.stream
|
||||
self.on_transaction.listen(
|
||||
lambda e: log.info(
|
||||
lambda e: log.debug(
|
||||
'(%s) on_transaction: address=%s, height=%s, is_verified=%s, tx.id=%s',
|
||||
self.get_id(), e.address, e.tx.height, e.tx.is_verified, e.tx.id
|
||||
)
|
||||
|
|
|
@ -74,7 +74,9 @@ class RocksReaderContext:
|
|||
def update_state(self):
|
||||
tx_counts = array.array("L")
|
||||
counts = self.db.get(TX_COUNTS_STATE)
|
||||
if counts:
|
||||
if not counts:
|
||||
self.tx_counts = list(map(unpack_be_uint64, self.db.iterator(prefix=TX_COUNT_PREFIX, include_key=False)))
|
||||
else:
|
||||
tx_counts.frombytes(counts)
|
||||
self.tx_counts = tx_counts.tolist()
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue